diff --git a/apps/client/src/widgets/collections/calendar/index.tsx b/apps/client/src/widgets/collections/calendar/index.tsx index 317382593..3aa9fc1d6 100644 --- a/apps/client/src/widgets/collections/calendar/index.tsx +++ b/apps/client/src/widgets/collections/calendar/index.tsx @@ -71,6 +71,7 @@ export const LOCALE_MAPPINGS: Record Promise<{ default: Local ro: () => import("@fullcalendar/core/locales/ro"), ru: () => import("@fullcalendar/core/locales/ru"), ja: () => import("@fullcalendar/core/locales/ja"), + pt: () => import("@fullcalendar/core/locales/pt"), "pt_br": () => import("@fullcalendar/core/locales/pt-br"), uk: () => import("@fullcalendar/core/locales/uk"), en: null diff --git a/apps/server/src/services/i18n.spec.ts b/apps/server/src/services/i18n.spec.ts index 050cc2cd1..a77368249 100644 --- a/apps/server/src/services/i18n.spec.ts +++ b/apps/server/src/services/i18n.spec.ts @@ -1,6 +1,7 @@ import { LOCALES } from "@triliumnext/commons"; import { readFileSync } from "fs"; import { join } from "path"; +import { DAYJS_LOADER } from "./i18n"; describe("i18n", () => { it("translations are valid JSON", () => { @@ -15,4 +16,13 @@ describe("i18n", () => { .not.toThrow(); } }); + + it("all dayjs locales are valid", async () => { + for (const locale of LOCALES) { + const dayjsLoader = DAYJS_LOADER[locale.id]; + expect(dayjsLoader, `Locale ${locale.id} missing.`).toBeDefined(); + + await dayjsLoader(); + } + }); }); diff --git a/apps/server/src/services/i18n.ts b/apps/server/src/services/i18n.ts index edc2115b8..1f1db1ac6 100644 --- a/apps/server/src/services/i18n.ts +++ b/apps/server/src/services/i18n.ts @@ -7,7 +7,7 @@ import hidden_subtree from "./hidden_subtree.js"; import { LOCALES, type Locale, type LOCALE_IDS } from "@triliumnext/commons"; import dayjs, { Dayjs } from "dayjs"; -const DAYJS_LOADER: Record Promise> = { +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"), @@ -19,6 +19,7 @@ const DAYJS_LOADER: Record Promise import("dayjs/locale/ja.js"), "ku": () => import("dayjs/locale/ku.js"), "pt_br": () => import("dayjs/locale/pt-br.js"), + "pt": () => import("dayjs/locale/pt.js"), "ro": () => import("dayjs/locale/ro.js"), "ru": () => import("dayjs/locale/ru.js"), "tw": () => import("dayjs/locale/zh-tw.js"), diff --git a/packages/commons/src/lib/i18n.ts b/packages/commons/src/lib/i18n.ts index d40f5ecc5..5970d2ab8 100644 --- a/packages/commons/src/lib/i18n.ts +++ b/packages/commons/src/lib/i18n.ts @@ -17,6 +17,7 @@ const UNSORTED_LOCALES: Locale[] = [ { id: "fr", name: "Français", electronLocale: "fr" }, { id: "ja", name: "日本語", electronLocale: "ja" }, { id: "pt_br", name: "Português (Brasil)", electronLocale: "pt_BR" }, + { id: "pt", name: "Português (Portugal)", electronLocale: "pt_PT" }, { id: "ro", name: "Română", electronLocale: "ro" }, { id: "ru", name: "Русский", electronLocale: "ru" }, { id: "tw", name: "繁體中文", electronLocale: "zh_TW" },