Skip to content

Build your personal knowledge base with Trilium Notes

feat(i18n): add Vietnamese as a UI language

Claude7da1e0e8b83d
diff --git a/apps/client/src/widgets/collections/calendar/index.tsx b/apps/client/src/widgets/collections/calendar/index.tsx
index c1bbb45759..3dca1fba7e 100644
--- a/apps/client/src/widgets/collections/calendar/index.tsx
+++ b/apps/client/src/widgets/collections/calendar/index.tsx
@@ -114,6 +114,7 @@ export const LOCALE_MAPPINGS: Record<DISPLAYABLE_LOCALE_IDS, (() => Promise<{ de
"pt_br": () => import("fullcalendar/locales/pt-br"),
tr: () => import("fullcalendar/locales/tr"),
uk: () => import("fullcalendar/locales/uk"),
+ vi: () => import("fullcalendar/locales/vi"),
en: null,
"en-GB": () => import("fullcalendar/locales/en-gb"),
"en_rtl": null,
diff --git a/apps/client/src/widgets/type_widgets/canvas/i18n.ts b/apps/client/src/widgets/type_widgets/canvas/i18n.ts
index 0dcbdd4ce1..b1787fccc0 100644
--- a/apps/client/src/widgets/type_widgets/canvas/i18n.ts
+++ b/apps/client/src/widgets/type_widgets/canvas/i18n.ts
@@ -24,5 +24,6 @@ export const LANGUAGE_MAPPINGS: Record<DISPLAYABLE_LOCALE_IDS, Language["code"]
ru: "ru-RU",
tr: "tr-TR",
tw: "zh-TW",
- uk: "uk-UA"
+ uk: "uk-UA",
+ vi: "vi-VN"
};
diff --git a/apps/client/src/widgets/type_widgets/spreadsheet/locales.ts b/apps/client/src/widgets/type_widgets/spreadsheet/locales.ts
index 812a4b09f0..1fc42ae441 100644
--- a/apps/client/src/widgets/type_widgets/spreadsheet/locales.ts
+++ b/apps/client/src/widgets/type_widgets/spreadsheet/locales.ts
@@ -181,7 +181,21 @@ export const UNIVER_LOCALES: Record<DISPLAYABLE_LOCALE_IDS, UniverLocaleSource |
])
},
tr: null,
- uk: null
+ uk: null,
+ vi: {
+ type: LocaleType.VI_VN,
+ load: () => Promise.all([
+ import('@univerjs/preset-sheets-core/locales/vi-VN'),
+ import('@univerjs/preset-sheets-drawing/locales/vi-VN'),
+ import('@univerjs/preset-sheets-find-replace/locales/vi-VN'),
+ import('@univerjs/preset-sheets-note/locales/vi-VN'),
+ import('@univerjs/preset-sheets-filter/locales/vi-VN'),
+ import('@univerjs/preset-sheets-sort/locales/vi-VN'),
+ import('@univerjs/preset-sheets-data-validation/locales/vi-VN'),
+ import('@univerjs/preset-sheets-conditional-formatting/locales/vi-VN'),
+ import('@univerjs/preset-sheets-hyper-link/locales/vi-VN')
+ ])
+ }
};
/** Resolves the Univer locale source for a Trilium UI language, falling back to {@link ENGLISH_LOCALE}. */
diff --git a/apps/client/src/widgets/type_widgets/text/quotes.ts b/apps/client/src/widgets/type_widgets/text/quotes.ts
index d5bd700ce2..4ba90250ab 100644
--- a/apps/client/src/widgets/type_widgets/text/quotes.ts
+++ b/apps/client/src/widgets/type_widgets/text/quotes.ts
@@ -41,6 +41,7 @@ const QUOTE_STYLES: Record<string, QuoteStyle> = {
zh: { primary: ["“", "”"], secondary: ["‘", "’"] },
"pt-br": { primary: ["“", "”"], secondary: ["‘", "’"] },
es: { primary: ["“", "”"], secondary: ["‘", "’"] },
+ vi: { primary: ["“", "”"], secondary: ["‘", "’"] },
// Listed although it now matches `en`, so that the agreement reads as a decision rather than an
// omission: British usage traditionally inverts the two levels — which is what CKEditor's own
// `quotesPrimaryEnGb` still does — but CLDR has en-GB on double quotes, following the publishers
diff --git a/apps/website/src/locales.ts b/apps/website/src/locales.ts
index b19bcfc159..b9a4446f6f 100644
--- a/apps/website/src/locales.ts
+++ b/apps/website/src/locales.ts
@@ -34,6 +34,7 @@ export const LOCALES: Locale[] = [
{ id: "ru", name: "Русский" },
{ id: "ug", name: "ئۇيغۇرچە", rtl: true },
{ id: "uk", name: "Українська" },
+ { id: "vi", name: "Tiếng Việt" },
{ id: "zh-Hans", name: "简体中文" },
{ id: "zh-Hant", name: "繁體中文" }
].toSorted((a, b) => a.name.localeCompare(b.name));
diff --git a/packages/ckeditor5/src/i18n.ts b/packages/ckeditor5/src/i18n.ts
index af1b1e4d18..aa80e1e918 100644
--- a/packages/ckeditor5/src/i18n.ts
+++ b/packages/ckeditor5/src/i18n.ts
@@ -92,6 +92,10 @@ const LOCALE_MAPPINGS: Record<DISPLAYABLE_LOCALE_IDS, LocaleMapping | null> = {
languageCode: "tr",
coreTranslation: () => import("ckeditor5/translations/tr.js"),
},
+ vi: {
+ languageCode: "vi",
+ coreTranslation: () => import("ckeditor5/translations/vi.js"),
+ },
};
/**
diff --git a/packages/commons/src/lib/dayjs.ts b/packages/commons/src/lib/dayjs.ts
index 50651629f9..9810e964dd 100644
--- a/packages/commons/src/lib/dayjs.ts
+++ b/packages/commons/src/lib/dayjs.ts
@@ -54,6 +54,7 @@ export const DAYJS_LOADER: Record<DISPLAYABLE_LOCALE_IDS, () => Promise<typeof i
"tr": () => import("dayjs/locale/tr.js"),
"tw": () => import("dayjs/locale/zh-tw.js"),
"uk": () => import("dayjs/locale/uk.js"),
+ "vi": () => import("dayjs/locale/vi.js"),
}
async function setDayjsLocale(locale: LOCALE_IDS) {
diff --git a/packages/commons/src/lib/i18n.ts b/packages/commons/src/lib/i18n.ts
index 941287e6f1..35b6e818c9 100644
--- a/packages/commons/src/lib/i18n.ts
+++ b/packages/commons/src/lib/i18n.ts
@@ -10,7 +10,7 @@ export interface Locale {
/** The value to pass to `--lang` for the Electron instance in order to set it as a locale. Not setting it will hide it from the list of supported locales. */
electronLocale?: "en" | "de" | "es" | "fr" | "zh_CN" | "zh_TW" | "ro" | "af" | "am" | "ar" | "bg" | "bn" | "ca" | "cs" | "da" | "el" | "en_GB" | "es_419" | "et" | "fa" | "fi" | "fil" | "gu" | "he" | "hi" | "hr" | "hu" | "id" | "it" | "ja" | "kn" | "ko" | "lt" | "lv" | "ml" | "mr" | "ms" | "nb" | "nl" | "pl" | "pt_BR" | "pt_PT" | "ru" | "sk" | "sl" | "sr" | "sv" | "sw" | "ta" | "te" | "th" | "tr" | "uk" | "ur" | "vi";
/** The Tesseract OCR language code for this locale (e.g. "eng", "fra", "deu"). See https://tesseract-ocr.github.io/tessdoc/Data-Files-in-different-versions.html */
- tesseractCode?: "eng" | "deu" | "spa" | "fra" | "gle" | "ita" | "hin" | "ind" | "jpn" | "por" | "pol" | "ron" | "rus" | "chi_sim" | "chi_tra" | "ukr" | "ara" | "heb" | "kur" | "fas" | "kor" | "ces" | "uig" | "tur";
+ tesseractCode?: "eng" | "deu" | "spa" | "fra" | "gle" | "ita" | "hin" | "ind" | "jpn" | "por" | "pol" | "ron" | "rus" | "chi_sim" | "chi_tra" | "ukr" | "ara" | "heb" | "kur" | "fas" | "kor" | "ces" | "uig" | "tur" | "vie";
}
// When adding a new locale, prefer the version with hyphen instead of underscore.
@@ -36,6 +36,7 @@ const UNSORTED_LOCALES = [
{ id: "tr", name: "Türkçe", electronLocale: "tr", tesseractCode: "tur" },
{ id: "tw", name: "繁體中文", electronLocale: "zh_TW", tesseractCode: "chi_tra" },
{ id: "uk", name: "Українська", electronLocale: "uk", tesseractCode: "ukr" },
+ { id: "vi", name: "Tiếng Việt", electronLocale: "vi", tesseractCode: "vie" },
/**
* Development-only languages.