Skip to content

Build your personal knowledge base with Trilium Notes

feat(settings/i18n): filter only display languages

Elian Dorand582fdea02f0
diff --git a/src/public/app/widgets/type_widgets/options/appearance/i18n.ts b/src/public/app/widgets/type_widgets/options/appearance/i18n.ts
index 1222c679ab..2c6b895858 100644
--- a/src/public/app/widgets/type_widgets/options/appearance/i18n.ts
+++ b/src/public/app/widgets/type_widgets/options/appearance/i18n.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "../options_widget.js";
import server from "../../../../services/server.js";
import utils from "../../../../services/utils.js";
-import { getAvailableLocales, t, type Locale } from "../../../../services/i18n.js";
+import { getAvailableLocales, t } from "../../../../services/i18n.js";
import type { OptionMap } from "../../../../../../services/options_interface.js";
const TPL = `
@@ -47,7 +47,7 @@ export default class LocalizationOptions extends OptionsWidget {
}
async optionsLoaded(options: OptionMap) {
- const availableLocales = getAvailableLocales();
+ const availableLocales = getAvailableLocales().filter(l => !l.contentOnly);
this.$localeSelect.empty();
for (const locale of availableLocales) {
diff --git a/src/services/i18n.ts b/src/services/i18n.ts
index 24068ce38b..e40a670abf 100644
--- a/src/services/i18n.ts
+++ b/src/services/i18n.ts
@@ -11,6 +11,8 @@ export interface Locale {
name: string;
/** `true` if the language is a right-to-left one, or `false` if it's left-to-right. */
rtl?: boolean;
+ /** `true` if the language is not supported by the application as a display language, but it is selectable by the user for the content. */
+ contentOnly?: boolean;
}
const LOCALES: Locale[] = [
@@ -51,22 +53,26 @@ const LOCALES: Locale[] = [
{ // Arabic
id: "ar",
name: "اَلْعَرَبِيَّةُ",
- rtl: true
+ rtl: true,
+ contentOnly: true
},
{ // Hebrew
id: "he",
name: "עברית",
- rtl: true
+ rtl: true,
+ contentOnly: true
},
{ // Kurdish
id: "ku",
name: "کوردی",
- rtl: true
+ rtl: true,
+ contentOnly: true
},
{ // Persian
id: "fa",
name: "فارسی",
- rtl: true
+ rtl: true,
+ contentOnly: true
}
].sort((a, b) => a.name.localeCompare(b.name));