feat(settings/i18n): filter only display languages

This commit is contained in:
Elian Doran 2025-03-04 22:19:37 +02:00
parent 775fd3f22b
commit d582fdea02
No known key found for this signature in database
2 changed files with 12 additions and 6 deletions

View File

@ -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) {

View File

@ -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));