@tginternal/language-util
v1.1.1
Published
Language data utility for Tolgee localization tool
Downloads
612
Readme
Language util
Suggesting
To get language data suggestions by user input:
import { suggest } from '@tginternal/language-util';
console.log(suggest('cs'));
[
{
englishName: 'Czech',
flags: ['🇨🇿'],
languageId: 'cs',
originalName: 'čeština',
},
{
englishName: "Czech (Czechia)",
flags: ["🇨🇿"],
languageId: "cs-CZ",
originalName: "čeština (Česko)"
},
{
englishName: "English",
flags: (89) ["🇬🇧", "🇺🇸", ...],
languageId: "en",
originalName: "English"
}
...
];
Validation
import { isValidLanguageTag } from '@tginternal/language-util';
isValidLanguageTag("cs-CZ") //true
isValidLanguageTag("cs_CZ") //false