Alphabetise languages by language code (#3350)
* Alphabetise languages in lingui.config.js * Alphabetise languages in helpers.ts * Alphabetise languages in i18n.ts * Alphabetise languages in i18n.ts * Alphabetise languages in i18n.web.ts * Alphabetise languages in languages.tszio/stable
parent
51e939ed3d
commit
8b3017bca0
|
@ -2,6 +2,7 @@
|
|||
module.exports = {
|
||||
locales: [
|
||||
'en',
|
||||
'ca',
|
||||
'de',
|
||||
'es',
|
||||
'fi',
|
||||
|
@ -9,15 +10,14 @@ module.exports = {
|
|||
'ga',
|
||||
'hi',
|
||||
'id',
|
||||
'it',
|
||||
'ja',
|
||||
'ko',
|
||||
'pt-BR',
|
||||
'tr',
|
||||
'uk',
|
||||
'ca',
|
||||
'zh-CN',
|
||||
'zh-TW',
|
||||
'it',
|
||||
'tr',
|
||||
],
|
||||
catalogs: [
|
||||
{
|
||||
|
|
|
@ -119,6 +119,8 @@ export function sanitizeAppLanguageSetting(appLanguage: string): AppLanguage {
|
|||
switch (lang) {
|
||||
case 'en':
|
||||
return AppLanguage.en
|
||||
case 'ca':
|
||||
return AppLanguage.ca
|
||||
case 'de':
|
||||
return AppLanguage.de
|
||||
case 'es':
|
||||
|
@ -133,24 +135,22 @@ export function sanitizeAppLanguageSetting(appLanguage: string): AppLanguage {
|
|||
return AppLanguage.hi
|
||||
case 'id':
|
||||
return AppLanguage.id
|
||||
case 'it':
|
||||
return AppLanguage.it
|
||||
case 'ja':
|
||||
return AppLanguage.ja
|
||||
case 'ko':
|
||||
return AppLanguage.ko
|
||||
case 'pt-BR':
|
||||
return AppLanguage.pt_BR
|
||||
case 'tr':
|
||||
return AppLanguage.tr
|
||||
case 'uk':
|
||||
return AppLanguage.uk
|
||||
case 'ca':
|
||||
return AppLanguage.ca
|
||||
case 'zh-CN':
|
||||
return AppLanguage.zh_CN
|
||||
case 'zh-TW':
|
||||
return AppLanguage.zh_TW
|
||||
case 'it':
|
||||
return AppLanguage.it
|
||||
case 'tr':
|
||||
return AppLanguage.tr
|
||||
default:
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -27,6 +27,10 @@ import {useLanguagePrefs} from '#/state/preferences'
|
|||
*/
|
||||
export async function dynamicActivate(locale: AppLanguage) {
|
||||
switch (locale) {
|
||||
case AppLanguage.ca: {
|
||||
i18n.loadAndActivate({locale, messages: messagesCa})
|
||||
break
|
||||
}
|
||||
case AppLanguage.de: {
|
||||
i18n.loadAndActivate({locale, messages: messagesDe})
|
||||
break
|
||||
|
@ -55,6 +59,10 @@ export async function dynamicActivate(locale: AppLanguage) {
|
|||
i18n.loadAndActivate({locale, messages: messagesId})
|
||||
break
|
||||
}
|
||||
case AppLanguage.it: {
|
||||
i18n.loadAndActivate({locale, messages: messagesIt})
|
||||
break
|
||||
}
|
||||
case AppLanguage.ja: {
|
||||
i18n.loadAndActivate({locale, messages: messagesJa})
|
||||
break
|
||||
|
@ -67,30 +75,22 @@ export async function dynamicActivate(locale: AppLanguage) {
|
|||
i18n.loadAndActivate({locale, messages: messagesPt_BR})
|
||||
break
|
||||
}
|
||||
case AppLanguage.uk: {
|
||||
i18n.loadAndActivate({locale, messages: messagesUk})
|
||||
case AppLanguage.tr: {
|
||||
i18n.loadAndActivate({locale, messages: messagesTr})
|
||||
break
|
||||
}
|
||||
case AppLanguage.ca: {
|
||||
i18n.loadAndActivate({locale, messages: messagesCa})
|
||||
case AppLanguage.uk: {
|
||||
i18n.loadAndActivate({locale, messages: messagesUk})
|
||||
break
|
||||
}
|
||||
case AppLanguage.zh_CN: {
|
||||
i18n.loadAndActivate({locale, messages: messagesZh_CN})
|
||||
break
|
||||
}
|
||||
case AppLanguage.it: {
|
||||
i18n.loadAndActivate({locale, messages: messagesIt})
|
||||
break
|
||||
}
|
||||
case AppLanguage.zh_TW: {
|
||||
i18n.loadAndActivate({locale, messages: messagesZh_TW})
|
||||
break
|
||||
}
|
||||
case AppLanguage.tr: {
|
||||
i18n.loadAndActivate({locale, messages: messagesTr})
|
||||
break
|
||||
}
|
||||
default: {
|
||||
i18n.loadAndActivate({locale, messages: messagesEn})
|
||||
break
|
||||
|
|
|
@ -12,6 +12,10 @@ export async function dynamicActivate(locale: AppLanguage) {
|
|||
let mod: any
|
||||
|
||||
switch (locale) {
|
||||
case AppLanguage.ca: {
|
||||
mod = await import(`./locales/ca/messages`)
|
||||
break
|
||||
}
|
||||
case AppLanguage.de: {
|
||||
mod = await import(`./locales/de/messages`)
|
||||
break
|
||||
|
@ -40,6 +44,10 @@ export async function dynamicActivate(locale: AppLanguage) {
|
|||
mod = await import(`./locales/id/messages`)
|
||||
break
|
||||
}
|
||||
case AppLanguage.it: {
|
||||
mod = await import(`./locales/it/messages`)
|
||||
break
|
||||
}
|
||||
case AppLanguage.ja: {
|
||||
mod = await import(`./locales/ja/messages`)
|
||||
break
|
||||
|
@ -52,12 +60,12 @@ export async function dynamicActivate(locale: AppLanguage) {
|
|||
mod = await import(`./locales/pt-BR/messages`)
|
||||
break
|
||||
}
|
||||
case AppLanguage.uk: {
|
||||
mod = await import(`./locales/uk/messages`)
|
||||
case AppLanguage.tr: {
|
||||
mod = await import(`./locales/tr/messages`)
|
||||
break
|
||||
}
|
||||
case AppLanguage.ca: {
|
||||
mod = await import(`./locales/ca/messages`)
|
||||
case AppLanguage.uk: {
|
||||
mod = await import(`./locales/uk/messages`)
|
||||
break
|
||||
}
|
||||
case AppLanguage.zh_CN: {
|
||||
|
@ -68,14 +76,6 @@ export async function dynamicActivate(locale: AppLanguage) {
|
|||
mod = await import(`./locales/zh-TW/messages`)
|
||||
break
|
||||
}
|
||||
case AppLanguage.it: {
|
||||
mod = await import(`./locales/it/messages`)
|
||||
break
|
||||
}
|
||||
case AppLanguage.tr: {
|
||||
mod = await import(`./locales/tr/messages`)
|
||||
break
|
||||
}
|
||||
default: {
|
||||
mod = await import(`./locales/en/messages`)
|
||||
break
|
||||
|
|
|
@ -6,6 +6,7 @@ interface Language {
|
|||
|
||||
export enum AppLanguage {
|
||||
en = 'en',
|
||||
ca = 'ca',
|
||||
de = 'de',
|
||||
es = 'es',
|
||||
fi = 'fi',
|
||||
|
@ -13,15 +14,14 @@ export enum AppLanguage {
|
|||
ga = 'ga',
|
||||
hi = 'hi',
|
||||
id = 'id',
|
||||
it = 'it',
|
||||
ja = 'ja',
|
||||
ko = 'ko',
|
||||
pt_BR = 'pt-BR',
|
||||
tr = 'tr',
|
||||
uk = 'uk',
|
||||
ca = 'ca',
|
||||
zh_CN = 'zh-CN',
|
||||
zh_TW = 'zh-TW',
|
||||
it = 'it',
|
||||
tr = 'tr',
|
||||
}
|
||||
|
||||
interface AppLanguageConfig {
|
||||
|
@ -31,22 +31,22 @@ interface AppLanguageConfig {
|
|||
|
||||
export const APP_LANGUAGES: AppLanguageConfig[] = [
|
||||
{code2: AppLanguage.en, name: 'English'},
|
||||
{code2: AppLanguage.ca, name: 'Català – Catalan'},
|
||||
{code2: AppLanguage.de, name: 'Deutsch – German'},
|
||||
{code2: AppLanguage.es, name: 'Español – Spanish'},
|
||||
{code2: AppLanguage.fi, name: 'Suomi – Finnish'},
|
||||
{code2: AppLanguage.fr, name: 'Français – French'},
|
||||
{code2: AppLanguage.ga, name: 'Gaeilge - Irish'},
|
||||
{code2: AppLanguage.ga, name: 'Gaeilge – Irish'},
|
||||
{code2: AppLanguage.hi, name: 'हिंदी – Hindi'},
|
||||
{code2: AppLanguage.id, name: 'Bahasa Indonesia – Indonesian'},
|
||||
{code2: AppLanguage.it, name: 'Italiano – Italian'},
|
||||
{code2: AppLanguage.ja, name: '日本語 – Japanese'},
|
||||
{code2: AppLanguage.ko, name: '한국어 – Korean'},
|
||||
{code2: AppLanguage.pt_BR, name: 'Português (BR) – Portuguese (BR)'},
|
||||
{code2: AppLanguage.tr, name: 'Türkçe – Turkish'},
|
||||
{code2: AppLanguage.uk, name: 'Українська – Ukrainian'},
|
||||
{code2: AppLanguage.ca, name: 'Català – Catalan'},
|
||||
{code2: AppLanguage.zh_CN, name: '简体中文(中国) – Chinese (Simplified)'},
|
||||
{code2: AppLanguage.zh_TW, name: '繁體中文(臺灣) – Chinese (Traditional)'},
|
||||
{code2: AppLanguage.it, name: 'Italiano - Italian'},
|
||||
{code2: AppLanguage.tr, name: 'Türkçe - Turkish'},
|
||||
{code2: AppLanguage.zh_CN, name: '简体中文(中国)– Chinese (Simplified)'},
|
||||
{code2: AppLanguage.zh_TW, name: '繁體中文(臺灣)– Chinese (Traditional)'},
|
||||
]
|
||||
|
||||
export const LANGUAGES: Language[] = [
|
||||
|
|
Loading…
Reference in New Issue