mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-11 19:22:31 +08:00
feat(settings/i18n): filter only display languages
This commit is contained in:
parent
775fd3f22b
commit
d582fdea02
@ -1,7 +1,7 @@
|
|||||||
import OptionsWidget from "../options_widget.js";
|
import OptionsWidget from "../options_widget.js";
|
||||||
import server from "../../../../services/server.js";
|
import server from "../../../../services/server.js";
|
||||||
import utils from "../../../../services/utils.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";
|
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
@ -47,7 +47,7 @@ export default class LocalizationOptions extends OptionsWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async optionsLoaded(options: OptionMap) {
|
async optionsLoaded(options: OptionMap) {
|
||||||
const availableLocales = getAvailableLocales();
|
const availableLocales = getAvailableLocales().filter(l => !l.contentOnly);
|
||||||
this.$localeSelect.empty();
|
this.$localeSelect.empty();
|
||||||
|
|
||||||
for (const locale of availableLocales) {
|
for (const locale of availableLocales) {
|
||||||
|
@ -11,6 +11,8 @@ export interface Locale {
|
|||||||
name: string;
|
name: string;
|
||||||
/** `true` if the language is a right-to-left one, or `false` if it's left-to-right. */
|
/** `true` if the language is a right-to-left one, or `false` if it's left-to-right. */
|
||||||
rtl?: boolean;
|
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[] = [
|
const LOCALES: Locale[] = [
|
||||||
@ -51,22 +53,26 @@ const LOCALES: Locale[] = [
|
|||||||
{ // Arabic
|
{ // Arabic
|
||||||
id: "ar",
|
id: "ar",
|
||||||
name: "اَلْعَرَبِيَّةُ",
|
name: "اَلْعَرَبِيَّةُ",
|
||||||
rtl: true
|
rtl: true,
|
||||||
|
contentOnly: true
|
||||||
},
|
},
|
||||||
{ // Hebrew
|
{ // Hebrew
|
||||||
id: "he",
|
id: "he",
|
||||||
name: "עברית",
|
name: "עברית",
|
||||||
rtl: true
|
rtl: true,
|
||||||
|
contentOnly: true
|
||||||
},
|
},
|
||||||
{ // Kurdish
|
{ // Kurdish
|
||||||
id: "ku",
|
id: "ku",
|
||||||
name: "کوردی",
|
name: "کوردی",
|
||||||
rtl: true
|
rtl: true,
|
||||||
|
contentOnly: true
|
||||||
},
|
},
|
||||||
{ // Persian
|
{ // Persian
|
||||||
id: "fa",
|
id: "fa",
|
||||||
name: "فارسی",
|
name: "فارسی",
|
||||||
rtl: true
|
rtl: true,
|
||||||
|
contentOnly: true
|
||||||
}
|
}
|
||||||
].sort((a, b) => a.name.localeCompare(b.name));
|
].sort((a, b) => a.name.localeCompare(b.name));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user