diff --git a/apps/client/src/widgets/collections/calendar/index.tsx b/apps/client/src/widgets/collections/calendar/index.tsx index bac6862b2..8bf5ce7f9 100644 --- a/apps/client/src/widgets/collections/calendar/index.tsx +++ b/apps/client/src/widgets/collections/calendar/index.tsx @@ -77,6 +77,7 @@ export const LOCALE_MAPPINGS: Record Promise<{ de "pt_br": () => import("@fullcalendar/core/locales/pt-br"), uk: () => import("@fullcalendar/core/locales/uk"), en: null, + "en-GB": () => import("@fullcalendar/core/locales/en-gb"), "en_rtl": null, ar: () => import("@fullcalendar/core/locales/ar") }; diff --git a/apps/client/src/widgets/type_widgets/MindMap.tsx b/apps/client/src/widgets/type_widgets/MindMap.tsx index eb54170c3..f8409c75c 100644 --- a/apps/client/src/widgets/type_widgets/MindMap.tsx +++ b/apps/client/src/widgets/type_widgets/MindMap.tsx @@ -28,6 +28,7 @@ const LOCALE_MAPPINGS: Record de: null, en: "en", en_rtl: "en", + "en-GB": "en", es: "es", fr: "fr", it: "it", diff --git a/apps/client/src/widgets/type_widgets/canvas/i18n.spec.ts b/apps/client/src/widgets/type_widgets/canvas/i18n.spec.ts index 71eb3d18c..c77e4979d 100644 --- a/apps/client/src/widgets/type_widgets/canvas/i18n.spec.ts +++ b/apps/client/src/widgets/type_widgets/canvas/i18n.spec.ts @@ -22,6 +22,7 @@ describe("Canvas i18n", () => { if (locale.contentOnly || locale.devOnly) continue; const languageCode = LANGUAGE_MAPPINGS[locale.id]; if (!supportedLanguageCodes.has(languageCode)) { + console.log("Supported locales:", Array.from(supportedLanguageCodes.values()).join(", ")); expect.fail(`Unable to find locale for ${locale.id} -> ${languageCode}.`) } } diff --git a/apps/client/src/widgets/type_widgets/canvas/i18n.ts b/apps/client/src/widgets/type_widgets/canvas/i18n.ts index 43ee724cf..47324abfc 100644 --- a/apps/client/src/widgets/type_widgets/canvas/i18n.ts +++ b/apps/client/src/widgets/type_widgets/canvas/i18n.ts @@ -1,10 +1,12 @@ +import { Language } from "@excalidraw/excalidraw/i18n"; import type { DISPLAYABLE_LOCALE_IDS } from "@triliumnext/commons"; -export const LANGUAGE_MAPPINGS: Record = { +export const LANGUAGE_MAPPINGS: Record = { ar: "ar-SA", cn: "zh-CN", de: "de-DE", en: "en", + "en-GB": "en", en_rtl: "en", es: "es-ES", fr: "fr-FR", diff --git a/apps/server/src/services/i18n.ts b/apps/server/src/services/i18n.ts index be7ebdeb5..82eb6f408 100644 --- a/apps/server/src/services/i18n.ts +++ b/apps/server/src/services/i18n.ts @@ -7,11 +7,13 @@ import hidden_subtree from "./hidden_subtree.js"; import { LOCALES, type Locale, type LOCALE_IDS } from "@triliumnext/commons"; import dayjs, { Dayjs } from "dayjs"; +// When adding a new locale, prefer the version with hyphen instead of underscore. export const DAYJS_LOADER: Record Promise> = { "ar": () => import("dayjs/locale/ar.js"), "cn": () => import("dayjs/locale/zh-cn.js"), "de": () => import("dayjs/locale/de.js"), "en": () => import("dayjs/locale/en.js"), + "en-GB": () => import("dayjs/locale/en-gb.js"), "en_rtl": () => import("dayjs/locale/en.js"), "es": () => import("dayjs/locale/es.js"), "fa": () => import("dayjs/locale/fa.js"), diff --git a/packages/ckeditor5/src/i18n.ts b/packages/ckeditor5/src/i18n.ts index 3053f4b7d..a409fa437 100644 --- a/packages/ckeditor5/src/i18n.ts +++ b/packages/ckeditor5/src/i18n.ts @@ -10,6 +10,11 @@ interface LocaleMapping { const LOCALE_MAPPINGS: Record = { en: null, en_rtl: null, + "en-GB": { + languageCode: "en-GB", + coreTranslation: () => import("ckeditor5/translations/en-gb.js"), + premiumFeaturesTranslation: () => import("ckeditor5-premium-features/translations/en-gb.js"), + }, ar: { languageCode: "ar", coreTranslation: () => import("ckeditor5/translations/ar.js"), diff --git a/packages/commons/src/lib/i18n.ts b/packages/commons/src/lib/i18n.ts index 65ff196d2..8d2bc0232 100644 --- a/packages/commons/src/lib/i18n.ts +++ b/packages/commons/src/lib/i18n.ts @@ -15,6 +15,7 @@ const UNSORTED_LOCALES = [ { id: "cn", name: "简体中文", electronLocale: "zh_CN" }, { id: "de", name: "Deutsch", electronLocale: "de" }, { id: "en", name: "English", electronLocale: "en" }, + { id: "en-GB", name: "English (United Kingdom)", electronLocale: "en_GB" }, { id: "es", name: "Español", electronLocale: "es" }, { id: "fr", name: "Français", electronLocale: "fr" }, { id: "it", name: "Italiano", electronLocale: "it" },