Skip to content

Build your personal knowledge base with Trilium Notes

feat(i18n): add Portuguese (Portugal)

Elian Doran3e30870c877c
diff --git a/apps/client/src/widgets/collections/calendar/index.tsx b/apps/client/src/widgets/collections/calendar/index.tsx
index 3173825931..3aa9fc1d60 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<LOCALE_IDS, (() => 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 050cc2cd1f..a773682496 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 edc2115b89..1f1db1ac60 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<LOCALE_IDS, () => Promise<typeof import("dayjs/locale/en.js")>> = {
+export const DAYJS_LOADER: Record<LOCALE_IDS, () => Promise<typeof import("dayjs/locale/en.js")>> = {
"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<LOCALE_IDS, () => Promise<typeof import("dayjs/locale
"ja": () => 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 d40f5ecc5d..5970d2ab82 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" },