feat(i18n): sort languages alphabetically

This commit is contained in:
Elian Doran 2025-03-04 20:51:22 +02:00
parent 951f4c4921
commit 4c89a2ac27
No known key found for this signature in database

View File

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