mirror of
https://github.com/zadam/trilium.git
synced 2025-11-05 04:45:47 +01:00
refactor(i18n): move list of locales out of options
This commit is contained in:
@@ -5,7 +5,7 @@ import log from "../../services/log.js";
|
|||||||
import searchService from "../../services/search/services/search.js";
|
import searchService from "../../services/search/services/search.js";
|
||||||
import ValidationError from "../../errors/validation_error.js";
|
import ValidationError from "../../errors/validation_error.js";
|
||||||
import type { Request } from "express";
|
import type { Request } from "express";
|
||||||
import { changeLanguage } from "../../services/i18n.js";
|
import { changeLanguage, getLocales } from "../../services/i18n.js";
|
||||||
import { listSyntaxHighlightingThemes } from "../../services/code_block_theme.js";
|
import { listSyntaxHighlightingThemes } from "../../services/code_block_theme.js";
|
||||||
import type { OptionNames } from "../../services/options_interface.js";
|
import type { OptionNames } from "../../services/options_interface.js";
|
||||||
|
|
||||||
@@ -154,37 +154,7 @@ function getSyntaxHighlightingThemes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getSupportedLocales() {
|
function getSupportedLocales() {
|
||||||
// TODO: Currently hardcoded, needs to read the list of available languages.
|
return getLocales();
|
||||||
return [
|
|
||||||
{
|
|
||||||
id: "en",
|
|
||||||
name: "English"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "de",
|
|
||||||
name: "Deutsch"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "es",
|
|
||||||
name: "Español"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "fr",
|
|
||||||
name: "Français"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "cn",
|
|
||||||
name: "简体中文"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "tw",
|
|
||||||
name: "繁體中文"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "ro",
|
|
||||||
name: "Română"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function isAllowed(name: string) {
|
function isAllowed(name: string) {
|
||||||
|
|||||||
@@ -20,6 +20,40 @@ export async function initializeTranslations() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getLocales() {
|
||||||
|
// TODO: Currently hardcoded, needs to read the list of available languages.
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
id: "en",
|
||||||
|
name: "English"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "de",
|
||||||
|
name: "Deutsch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "es",
|
||||||
|
name: "Español"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "fr",
|
||||||
|
name: "Français"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "cn",
|
||||||
|
name: "简体中文"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "tw",
|
||||||
|
name: "繁體中文"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "ro",
|
||||||
|
name: "Română"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
function getCurrentLanguage() {
|
function getCurrentLanguage() {
|
||||||
let language;
|
let language;
|
||||||
if (sql_init.isDbInitialized()) {
|
if (sql_init.isDbInitialized()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user