본문으로 건너뛰기

React Spreadsheet 로컬라이제이션

React Spreadsheet는 UI의 서로 다른 측면을 위한 두 가지 별개의 로컬라이제이션 메커니즘을 제공합니다.

두 가지 로컬라이제이션 메커니즘

메커니즘Prop제어 대상
UI 로컬라이제이션spreadsheetLocale메뉴 레이블, 툴바 툴팁, 대화 상자 텍스트, 로컬라이즈된 수식 이름
숫자/날짜 형식 지정localization소수점 구분 기호, 통화 기호, 날짜/시간 표시 형식

이 props는 독립적입니다. 하나 또는 둘 다 사용할 수 있습니다.

UI 로컬라이제이션 (spreadsheetLocale)

spreadsheetLocale prop은 두 가지 속성을 가진 SpreadsheetLocale 객체를 받습니다.

  • locale - UI 문자열 재정의의 Record<string, string>
  • formulas - 카테고리별로 그룹화된 로컬라이즈된 수식 이름의 Record<string, [string, string?][]>
const locale: SpreadsheetLocale = {
locale: {
"File": "Datei",
"Edit": "Bearbeiten",
"Insert": "Einfügen",
"Undo": "Rückgängig",
"Redo": "Wiederherstellen",
// ... 더 많은 UI 문자열
},
formulas: {
"MATCH": [
["Suchwert", "Erforderlich. Der Wert, der im Sucharray abgeglichen werden soll."],
["Sucharray", "Erforderlich. Ein Zellbereich oder ein Array-Bezug."],
],
// ... 더 많은 수식 카테고리
},
};

<ReactSpreadsheet sheets={sheets} spreadsheetLocale={locale} />
경고

spreadsheetLocale은 초기화 전용 prop입니다. 초기 렌더링 후 이 값을 변경하면 위젯이 소멸되고 재생성됩니다. 실행 취소/다시 실행 기록과 UI 상태(선택 영역, 스크롤 위치)가 초기화됩니다.

숫자/날짜 형식 지정 (localization)

localization prop은 숫자와 날짜의 표시 방식을 제어합니다. 소수점 구분 기호, 통화 기호, 날짜 패턴을 설정합니다. DHTMLX Spreadsheet localization 구성 속성과 동일한 형식을 사용합니다.

<ReactSpreadsheet
sheets={sheets}
localization={{
decimal: ",",
thousands: " ",
currency: "€",
}}
/>
경고

localization도 초기화 전용 prop입니다. 값을 변경하면 전체 소멸/재생성 주기가 실행됩니다.