Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
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.tsindex 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.tsindex 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[] = [{ // Arabicid: "ar",name: "اَلْعَرَبِيَّةُ",- rtl: true+ rtl: true,+ contentOnly: true},{ // Hebrewid: "he",name: "עברית",- rtl: true+ rtl: true,+ contentOnly: true},{ // Kurdishid: "ku",name: "کوردی",- rtl: true+ rtl: true,+ contentOnly: true},{ // Persianid: "fa",name: "فارسی",- rtl: true+ rtl: true,+ contentOnly: true}].sort((a, b) => a.name.localeCompare(b.name));