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,6 +13,63 @@ export interface Locale {
|
|||||||
rtl?: boolean;
|
rtl?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const LOCALES: Locale[] = [
|
||||||
|
{
|
||||||
|
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ă"
|
||||||
|
},
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Right to left languages
|
||||||
|
*
|
||||||
|
* Currently they are only for setting the language of text notes.
|
||||||
|
*/
|
||||||
|
{ // Arabic
|
||||||
|
id: "ar",
|
||||||
|
name: "اَلْعَرَبِيَّةُ",
|
||||||
|
rtl: true
|
||||||
|
},
|
||||||
|
{ // Hebrew
|
||||||
|
id: "he",
|
||||||
|
name: "עברית",
|
||||||
|
rtl: true
|
||||||
|
},
|
||||||
|
{ // Kurdish
|
||||||
|
id: "ku",
|
||||||
|
name: "کوردی",
|
||||||
|
rtl: true
|
||||||
|
},
|
||||||
|
{ // Persian
|
||||||
|
id: "fa",
|
||||||
|
name: "فارسی",
|
||||||
|
rtl: true
|
||||||
|
}
|
||||||
|
].sort((a, b) => a.name.localeCompare(b.name));
|
||||||
|
|
||||||
export async function initializeTranslations() {
|
export async function initializeTranslations() {
|
||||||
const resourceDir = getResourceDir();
|
const resourceDir = getResourceDir();
|
||||||
|
|
||||||
@ -28,63 +85,7 @@ export async function initializeTranslations() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getLocales(): Locale[] {
|
export function getLocales(): Locale[] {
|
||||||
// TODO: Currently hardcoded, needs to read the list of available languages.
|
return LOCALES;
|
||||||
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ă"
|
|
||||||
},
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Right to left languages
|
|
||||||
*
|
|
||||||
* Currently they are only for setting the language of text notes.
|
|
||||||
*/
|
|
||||||
{ // Arabic
|
|
||||||
id: "ar",
|
|
||||||
name: "اَلْعَرَبِيَّةُ",
|
|
||||||
rtl: true
|
|
||||||
},
|
|
||||||
{ // Hebrew
|
|
||||||
id: "he",
|
|
||||||
name: "עברית",
|
|
||||||
rtl: true
|
|
||||||
},
|
|
||||||
{ // Kurdish
|
|
||||||
id: "ku",
|
|
||||||
name: "کوردی",
|
|
||||||
rtl: true
|
|
||||||
},
|
|
||||||
{ // Persian
|
|
||||||
id: "fa",
|
|
||||||
name: "فارسی",
|
|
||||||
rtl: true
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentLanguage() {
|
function getCurrentLanguage() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user