Spaces:
Running
on
T4
Running
on
T4
File size: 2,363 Bytes
2485dd8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
const LANG3_FULL = {
eng: 'english',
arb: 'arabic',
asm: 'assamese',
bel: 'belarusian',
bul: 'bulgarian',
ben: 'bengali',
cat: 'catalan',
ces: 'czech',
cym: 'welsh',
dan: 'danish',
deu: 'german',
ell: 'greek',
spa: 'spanish',
est: 'estonian',
pes: 'persian',
fin: 'finnish',
fra: 'french',
hin: 'hindi',
hun: 'hungarian',
ind: 'indonesian',
ita: 'italian',
jpn: 'japanese',
kat: 'georgian',
lit: 'lithuanian',
lvs: 'latvian',
khk: 'mongolian',
mar: 'marathi',
mlt: 'maltese',
nld: 'dutch',
pan: 'punjabi',
pol: 'polish',
por: 'portuguese',
ron: 'romanian',
rus: 'russian',
slk: 'slovak',
slv: 'slovenian',
swe: 'swedish',
swh: 'swahili',
tam: 'tamil',
tha: 'thai',
tur: 'turkish',
ukr: 'ukrainian',
urd: 'urdu',
uzn: 'uzbek',
vie: 'vietnamese',
cmn: 'chinese',
afr: 'afrikaans',
isl: 'icelandic',
ltz: 'luxembourgish',
nob: 'norwegian',
glg: 'galician',
bos: 'bosnian',
hrv: 'croatian',
mkd: 'macedonian',
srp: 'serbian',
hye: 'armenian',
azj: 'azerbaijani',
kaz: 'kazakh',
kor: 'korean',
guj: 'gujarati',
kan: 'kannada',
npi: 'nepali',
snd: 'sindhi',
tel: 'telugu',
jav: 'javanese',
zlm: 'malay',
mal: 'malayalam',
tgl: 'tagalog',
mya: 'myanmar',
khm: 'khmer',
lao: 'lao',
heb: 'hebrew',
pbt: 'pashto',
tgk: 'tajik',
amh: 'amharic',
lin: 'lingala',
som: 'somali',
yor: 'yoruba',
sna: 'shona',
mri: 'maori',
hau: 'hausa',
oci: 'occitan',
bak: 'bashkir',
bre: 'breton',
yid: 'yiddish',
hat: 'haitian creole',
mlg: 'malagasy',
sin: 'sinhala',
sqi: 'albanian',
sun: 'sundanese',
eus: 'basque',
nno: 'nynorsk',
tat: 'tatar',
bod: 'tibetan',
fao: 'faroese',
haw: 'hawaiian',
lat: 'latin',
san: 'sanskrit',
tuk: 'turkmen'
};
export function getLanguageFromThreeLetterCode(code: string): string | null {
try {
const name = LANG3_FULL[code] ?? null;
if (name == null) {
return null;
}
const capitalizedWords = name
.split(' ')
.map((word: string) => word[0].toUpperCase() + word.slice(1));
return capitalizedWords.join(' ');
} catch (e) {
console.warn(`Unable to get language name for code ${code}: ${e}`);
}
return null;
}
|