Skip to content

Build your personal knowledge base with Trilium Notes

feat(i18n): offer Korean as a display language

Elian Dorand2e55fb8f8de
diff --git a/apps/client/src/widgets/collections/calendar/index.tsx b/apps/client/src/widgets/collections/calendar/index.tsx
index be4a3734b5..c6f2a5774a 100644
--- a/apps/client/src/widgets/collections/calendar/index.tsx
+++ b/apps/client/src/widgets/collections/calendar/index.tsx
@@ -97,6 +97,7 @@ export const LOCALE_MAPPINGS: Record<DISPLAYABLE_LOCALE_IDS, (() => Promise<{ de
ro: () => import("@fullcalendar/core/locales/ro"),
ru: () => import("@fullcalendar/core/locales/ru"),
ja: () => import("@fullcalendar/core/locales/ja"),
+ ko: () => import("@fullcalendar/core/locales/ko"),
pt: () => import("@fullcalendar/core/locales/pt"),
pl: () => import("@fullcalendar/core/locales/pl"),
"pt_br": () => import("@fullcalendar/core/locales/pt-br"),
diff --git a/apps/client/src/widgets/type_widgets/canvas/i18n.ts b/apps/client/src/widgets/type_widgets/canvas/i18n.ts
index cb7803547e..5fd322ab21 100644
--- a/apps/client/src/widgets/type_widgets/canvas/i18n.ts
+++ b/apps/client/src/widgets/type_widgets/canvas/i18n.ts
@@ -16,6 +16,7 @@ export const LANGUAGE_MAPPINGS: Record<DISPLAYABLE_LOCALE_IDS, Language["code"]
it: "it-IT",
hi: "hi-IN",
ja: "ja-JP",
+ ko: "ko-KR",
pt: "pt-PT",
pl: "pl-PL",
pt_br: "pt-BR",
diff --git a/apps/client/src/widgets/type_widgets/spreadsheet/locales.ts b/apps/client/src/widgets/type_widgets/spreadsheet/locales.ts
index 0f323c1e95..e668fb5555 100644
--- a/apps/client/src/widgets/type_widgets/spreadsheet/locales.ts
+++ b/apps/client/src/widgets/type_widgets/spreadsheet/locales.ts
@@ -134,6 +134,20 @@ export const UNIVER_LOCALES: Record<DISPLAYABLE_LOCALE_IDS, UniverLocaleSource |
import('@univerjs/preset-sheets-hyper-link/locales/ja-JP')
])
},
+ ko: {
+ type: LocaleType.KO_KR,
+ load: () => Promise.all([
+ import('@univerjs/preset-sheets-core/locales/ko-KR'),
+ import('@univerjs/preset-sheets-drawing/locales/ko-KR'),
+ import('@univerjs/preset-sheets-find-replace/locales/ko-KR'),
+ import('@univerjs/preset-sheets-note/locales/ko-KR'),
+ import('@univerjs/preset-sheets-filter/locales/ko-KR'),
+ import('@univerjs/preset-sheets-sort/locales/ko-KR'),
+ import('@univerjs/preset-sheets-data-validation/locales/ko-KR'),
+ import('@univerjs/preset-sheets-conditional-formatting/locales/ko-KR'),
+ import('@univerjs/preset-sheets-hyper-link/locales/ko-KR')
+ ])
+ },
pt_br: null,
pt: null,
pl: null,
diff --git a/docs/Developer Guide/Developer Guide/Concepts/Internationalisation Translations/Adding a new locale.md b/docs/Developer Guide/Developer Guide/Concepts/Internationalisation Translations/Adding a new locale.md
index f45605d901..88181adb0d 100644
--- a/docs/Developer Guide/Developer Guide/Concepts/Internationalisation Translations/Adding a new locale.md
+++ b/docs/Developer Guide/Developer Guide/Concepts/Internationalisation Translations/Adding a new locale.md
@@ -7,5 +7,8 @@ To do so:
2. In `packages/commons` look for `dayjs.ts` and add a mapping for the new language in `DAYJS_LOADER`. Sort the entire list.
3. In `apps/client`, look for `collections/calendar/index.tsx` and modify `LOCALE_MAPPINGS` to add support to the new language.
4. In `apps/client`, look for `widgets/type_widgets/canvas/i18n.ts` and modify `LANGUAGE_MAPPINGS`. A unit test ensures that the language is actually loadable.
-5. In `packages/ckeditor5`, look for `i18n.ts` and modify `LOCALE_MAPPINGS`. The import validation should already check if the new value is supported by CKEditor, and there's also a test to ensure it.
-6. Locale mappings for PDF.js might need adjustment. To do so, in `packages/pdfjs-viewer/scripts/build.ts` there is `LOCALE_MAPPINGS`.
\ No newline at end of file
+5. In `packages/ckeditor5`, look for `i18n.ts` and modify `LOCALE_MAPPINGS`. The import validation should already check if the new value is supported by CKEditor, and there's also a test to ensure it. The test in `i18n.spec.ts` pins every locale by hand rather than iterating them, so add the new one there as well.
+6. In `apps/client`, look for `widgets/type_widgets/spreadsheet/locales.ts` and modify `UNIVER_LOCALES`, either with a source (if Univer ships a bundle for the language) or with an explicit `null` to fall back to English. Every preset in `SPREADSHEET_PRESET_PACKAGES` must have a bundle for the locale, which `locales.spec.ts` checks.
+7. Locale mappings for PDF.js might need adjustment. To do so, in `packages/pdfjs-viewer/scripts/build.ts` there is `LOCALE_MAPPINGS`. No entry is needed when the locale's `electronLocale` already names a directory under `packages/pdfjs-viewer/viewer/locale`.
+
+Steps 1 to 6 are keyed by `DISPLAYABLE_LOCALE_IDS`, so `pnpm typecheck` reports each one still missing after step 1.
\ No newline at end of file
diff --git a/packages/ckeditor5/src/i18n.spec.ts b/packages/ckeditor5/src/i18n.spec.ts
index eb88147307..70b2e6eda7 100644
--- a/packages/ckeditor5/src/i18n.spec.ts
+++ b/packages/ckeditor5/src/i18n.spec.ts
@@ -24,6 +24,7 @@ describe("getCkLocale", () => {
[ "it", "it" ],
[ "hi", "hi" ],
[ "ja", "ja" ],
+ [ "ko", "ko" ],
[ "pl", "pl" ],
[ "pt", "pt" ],
[ "pt_br", "pt-br" ],
diff --git a/packages/ckeditor5/src/i18n.ts b/packages/ckeditor5/src/i18n.ts
index ec0417b516..297e062ef6 100644
--- a/packages/ckeditor5/src/i18n.ts
+++ b/packages/ckeditor5/src/i18n.ts
@@ -54,6 +54,10 @@ const LOCALE_MAPPINGS: Record<DISPLAYABLE_LOCALE_IDS, LocaleMapping | null> = {
languageCode: "ja",
coreTranslation: () => import("ckeditor5/translations/ja.js"),
},
+ ko: {
+ languageCode: "ko",
+ coreTranslation: () => import("ckeditor5/translations/ko.js"),
+ },
pl: {
languageCode: "pl",
coreTranslation: () => import("ckeditor5/translations/pl.js"),
diff --git a/packages/commons/src/lib/dayjs.ts b/packages/commons/src/lib/dayjs.ts
index 4d1afbc94b..7819991209 100644
--- a/packages/commons/src/lib/dayjs.ts
+++ b/packages/commons/src/lib/dayjs.ts
@@ -45,6 +45,7 @@ export const DAYJS_LOADER: Record<DISPLAYABLE_LOCALE_IDS, () => Promise<typeof i
"it": () => import("dayjs/locale/it.js"),
"hi": () => import("dayjs/locale/hi.js"),
"ja": () => import("dayjs/locale/ja.js"),
+ "ko": () => import("dayjs/locale/ko.js"),
"pt_br": () => import("dayjs/locale/pt-br.js"),
"pt": () => import("dayjs/locale/pt.js"),
"pl": () => import("dayjs/locale/pl.js"),
diff --git a/packages/commons/src/lib/i18n.ts b/packages/commons/src/lib/i18n.ts
index 13c6d514be..55cc8039c5 100644
--- a/packages/commons/src/lib/i18n.ts
+++ b/packages/commons/src/lib/i18n.ts
@@ -27,6 +27,7 @@ const UNSORTED_LOCALES = [
{ id: "it", name: "Italiano", electronLocale: "it", tesseractCode: "ita" },
{ id: "hi", name: "हिन्दी", electronLocale: "hi", tesseractCode: "hin" },
{ id: "ja", name: "日本語", electronLocale: "ja", tesseractCode: "jpn" },
+ { id: "ko", name: "한국어", electronLocale: "ko", tesseractCode: "kor" },
{ id: "pt_br", name: "Português (Brasil)", electronLocale: "pt_BR", tesseractCode: "por" },
{ id: "pt", name: "Português (Portugal)", electronLocale: "pt_PT", tesseractCode: "por" },
{ id: "pl", name: "Polski", electronLocale: "pl", tesseractCode: "pol" },