2022-09-20 16:27:26 -07:00
|
|
|
const languages = [
|
|
|
|
'ar',
|
|
|
|
'ca',
|
|
|
|
'cs',
|
|
|
|
'de',
|
|
|
|
'eo',
|
|
|
|
'en',
|
|
|
|
'es',
|
|
|
|
'et',
|
|
|
|
'eu',
|
|
|
|
'fi',
|
|
|
|
'fr',
|
|
|
|
'ga',
|
|
|
|
'he',
|
|
|
|
'hu',
|
|
|
|
'it',
|
|
|
|
'ja',
|
|
|
|
'ja_easy',
|
|
|
|
'ko',
|
2023-06-20 07:52:41 -07:00
|
|
|
'nan',
|
2022-09-20 16:27:26 -07:00
|
|
|
'nb',
|
|
|
|
'nl',
|
|
|
|
'oc',
|
|
|
|
'pl',
|
|
|
|
'pt',
|
|
|
|
'ro',
|
|
|
|
'ru',
|
|
|
|
'sk',
|
|
|
|
'te',
|
|
|
|
'uk',
|
|
|
|
'zh',
|
|
|
|
'zh_Hant'
|
|
|
|
]
|
|
|
|
|
|
|
|
const specialJsonName = {
|
|
|
|
ja: 'ja_pedantic'
|
|
|
|
}
|
|
|
|
|
|
|
|
const langCodeToJsonName = (code) => specialJsonName[code] || code
|
|
|
|
|
2022-09-20 17:15:32 -07:00
|
|
|
const langCodeToCldrName = (code) => code
|
|
|
|
|
|
|
|
const ensureFinalFallback = codes => {
|
2022-09-20 17:44:52 -07:00
|
|
|
const codeList = Array.isArray(codes) ? codes : [codes]
|
|
|
|
return codeList.includes('en') ? codeList : codeList.concat(['en'])
|
2022-09-20 17:15:32 -07:00
|
|
|
}
|
|
|
|
|
2022-09-20 16:27:26 -07:00
|
|
|
module.exports = {
|
|
|
|
languages,
|
2022-09-20 17:15:32 -07:00
|
|
|
langCodeToJsonName,
|
|
|
|
langCodeToCldrName,
|
|
|
|
ensureFinalFallback
|
2022-09-20 16:27:26 -07:00
|
|
|
}
|