Skip to content

Build your personal knowledge base with Trilium Notes

feat(i18n): add support for Brazilian Portuguese

Elian Doran5a767dae343f
diff --git a/apps/client/src/widgets/view_widgets/calendar_view.ts b/apps/client/src/widgets/view_widgets/calendar_view.ts
index d49caa5288..febac6f4de 100644
--- a/apps/client/src/widgets/view_widgets/calendar_view.ts
+++ b/apps/client/src/widgets/view_widgets/calendar_view.ts
@@ -676,6 +676,8 @@ export async function getFullCalendarLocale(locale: string) {
return (await import("@fullcalendar/core/locales/ru")).default;
case "ja":
return (await import("@fullcalendar/core/locales/ja")).default;
+ case "pt_BR":
+ return (await import("@fullcalendar/core/locales/pt-br")).default;
case "uk":
return (await import("@fullcalendar/core/locales/uk")).default;
case "en":
diff --git a/apps/server/src/services/i18n.ts b/apps/server/src/services/i18n.ts
index beb443a197..c849ecc5aa 100644
--- a/apps/server/src/services/i18n.ts
+++ b/apps/server/src/services/i18n.ts
@@ -18,6 +18,7 @@ const DAYJS_LOADER: Record<LOCALE_IDS, () => Promise<typeof import("dayjs/locale
"he": () => import("dayjs/locale/he.js"),
"ja": () => import("dayjs/locale/ja.js"),
"ku": () => import("dayjs/locale/ku.js"),
+ "pt_BR": () => import("dayjs/locale/pt_BR.js"),
"ro": () => import("dayjs/locale/ro.js"),
"ru": () => import("dayjs/locale/ru.js"),
"tw": () => import("dayjs/locale/zh-tw.js"),
@@ -40,8 +41,10 @@ export async function initializeTranslations() {
});
// Initialize dayjs locale.
- const dayjsLocale = await DAYJS_LOADER[locale]();
- dayjs.locale(dayjsLocale);
+ const dayjsLocale = DAYJS_LOADER[locale];
+ if (dayjsLocale) {
+ dayjs.locale(await dayjsLocale());
+ }
}
export function ordinal(date: Dayjs) {
diff --git a/packages/commons/src/lib/i18n.ts b/packages/commons/src/lib/i18n.ts
index ad0462c796..24d775658f 100644
--- a/packages/commons/src/lib/i18n.ts
+++ b/packages/commons/src/lib/i18n.ts
@@ -10,56 +10,17 @@ export interface Locale {
}
const UNSORTED_LOCALES: Locale[] = [
- {
- id: "en",
- name: "English",
- electronLocale: "en"
- },
- {
- id: "de",
- name: "Deutsch",
- electronLocale: "de"
- },
- {
- id: "es",
- name: "Español",
- electronLocale: "es"
- },
- {
- id: "fr",
- name: "Français",
- electronLocale: "fr"
- },
- {
- id: "cn",
- name: "简体中文",
- electronLocale: "zh_CN"
- },
- {
- id: "tw",
- name: "繁體中文",
- electronLocale: "zh_TW"
- },
- {
- id: "ro",
- name: "Română",
- electronLocale: "ro"
- },
- {
- id: "ru",
- name: "Русский",
- electronLocale: "ru"
- },
- {
- id: "uk",
- name: "Українська",
- electronLocale: "uk"
- },
- {
- id: "ja",
- name: "日本語",
- electronLocale: "ja"
- },
+ { id: "cn", name: "简体中文", electronLocale: "zh_CN" },
+ { id: "de", name: "Deutsch", electronLocale: "de" },
+ { id: "en", name: "English", electronLocale: "en" },
+ { id: "es", name: "Español", electronLocale: "es" },
+ { id: "fr", name: "Français", electronLocale: "fr" },
+ { id: "ja", name: "日本語", electronLocale: "ja" },
+ { id: "pt_BR", name: "Português (Brasil)", electronLocale: "pt-BR" },
+ { id: "ro", name: "Română", electronLocale: "ro" },
+ { id: "ru", name: "Русский", electronLocale: "ru" },
+ { id: "tw", name: "繁體中文", electronLocale: "zh_TW" },
+ { id: "uk", name: "Українська", electronLocale: "uk" },
/*
* Right to left languages