feat(i18n): add Portuguese (Portugal)

This commit is contained in:
Elian Doran 2025-10-08 11:39:06 +03:00
parent ee1a11975c
commit 3e30870c87
No known key found for this signature in database
4 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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();
}
});
});

View File

@ -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"),

View File

@ -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" },