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(client/rtl): hide English RTL from production
Elian Dorand35f97d99a89
diff --git a/apps/client/src/widgets/type_widgets/options/i18n.tsx b/apps/client/src/widgets/type_widgets/options/i18n.tsxindex 309f164bb6..d69e2a3956 100644--- a/apps/client/src/widgets/type_widgets/options/i18n.tsx+++ b/apps/client/src/widgets/type_widgets/options/i18n.tsx@@ -24,9 +24,13 @@ export default function InternationalizationOptions() {function LocalizationOptions() {const { uiLocales, formattingLocales: contentLocales } = useMemo(() => {- const allLocales = getAvailableLocales();+ const allLocales = getAvailableLocales();return {- uiLocales: allLocales.filter(locale => !locale.contentOnly),+ uiLocales: allLocales.filter(locale => {+ if (locale.contentOnly) return false;+ if (locale.devOnly && !glob.isDev) return false;+ return true;+ }),formattingLocales: allLocales.filter(locale => locale.electronLocale),}}, []);@@ -53,7 +57,7 @@ function LocaleSelector({ id, locales, currentValue, onChange }: { id?: string;return <FormSelectid={id}values={locales}- keyProperty="id" titleProperty="name"+ keyProperty="id" titleProperty="name"currentValue={currentValue} onChange={onChange}/>;}@@ -74,7 +78,7 @@ function DateSettings() {]}currentValue={firstDayOfWeek} onChange={setFirstDayOfWeek}/>- </OptionsRow>+ </OptionsRow><OptionsRow name="first-week-of-year" label={t("i18n.first-week-of-the-year")}><FormRadioGroup@@ -93,7 +97,7 @@ function DateSettings() {keyProperty="days"currentValue={minDaysInFirstWeek} onChange={setMinDaysInFirstWeek}values={Array.from(- { length: 7 },+ { length: 7 },(_, i) => ({ days: String(i + 1) }))} /></OptionsRow>}@@ -139,4 +143,4 @@ export function ContentLanguagesList() {columnWidth="300px"/>);-}\ No newline at end of file+}diff --git a/packages/commons/src/lib/i18n.ts b/packages/commons/src/lib/i18n.tsindex a6679f5427..4941c2db70 100644--- a/packages/commons/src/lib/i18n.ts+++ b/packages/commons/src/lib/i18n.ts@@ -5,6 +5,8 @@ export interface Locale {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;+ /** `true` if the language should only be visible while in development mode, and not in production. */+ devOnly?: boolean;/** 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";}@@ -28,7 +30,13 @@ const UNSORTED_LOCALES: Locale[] = [** These are only displayed while in dev mode, to test some language particularities (such as RTL) more easily.*/- { id: "en_rtl", name: "English (right-to-left) [dev]", electronLocale: "en", rtl: true },+ {+ id: "en_rtl",+ name: "English (right-to-left) [dev]",+ electronLocale: "en",+ rtl: true,+ devOnly: true+ },/** Right to left languages