mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-10 10:22:29 +08:00
feat(i18n): sort languages alphabetically
This commit is contained in:
parent
951f4c4921
commit
4c89a2ac27
@ -13,23 +13,7 @@ export interface Locale {
|
||||
rtl?: boolean;
|
||||
}
|
||||
|
||||
export async function initializeTranslations() {
|
||||
const resourceDir = getResourceDir();
|
||||
|
||||
// Initialize translations
|
||||
await i18next.use(Backend).init({
|
||||
lng: getCurrentLanguage(),
|
||||
fallbackLng: "en",
|
||||
ns: "server",
|
||||
backend: {
|
||||
loadPath: join(resourceDir, "translations/{{lng}}/{{ns}}.json")
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function getLocales(): Locale[] {
|
||||
// TODO: Currently hardcoded, needs to read the list of available languages.
|
||||
return [
|
||||
const LOCALES: Locale[] = [
|
||||
{
|
||||
id: "en",
|
||||
name: "English"
|
||||
@ -84,7 +68,24 @@ export function getLocales(): Locale[] {
|
||||
name: "فارسی",
|
||||
rtl: true
|
||||
}
|
||||
];
|
||||
].sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
export async function initializeTranslations() {
|
||||
const resourceDir = getResourceDir();
|
||||
|
||||
// Initialize translations
|
||||
await i18next.use(Backend).init({
|
||||
lng: getCurrentLanguage(),
|
||||
fallbackLng: "en",
|
||||
ns: "server",
|
||||
backend: {
|
||||
loadPath: join(resourceDir, "translations/{{lng}}/{{ns}}.json")
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function getLocales(): Locale[] {
|
||||
return LOCALES;
|
||||
}
|
||||
|
||||
function getCurrentLanguage() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user