@arianee/iso-language-picker
v0.5.0
Published
This library aims to helps developer trying to understand what language should be displayed to user
Downloads
144
Keywords
Readme
purpose
This library aims to remove headache from developer who tries to know what language he/she should diplay to user. We tried to follow the best pratice from https://tools.ietf.org/html/bcp47.
Available methods
pickLanguageAccordingToUserLanguages
import {pickLanguageAccordingToUserLanguages} from '@arianee/iso-language-picker';
const userLanguages= ['es', 'en-US'];
const availableLanguages= ['fr', 'en'];
const defaultLanguage='pt';
pickLanguageAccordingToUserLanguages(userLanguages,availableLanguages,defaultLanguage)
//output 'en';
pickLanguageAccordingToUserLanguages
import {pickLanguageAccordingToUserLanguagesWithMacrosFallback} from '@arianee/iso-language-picker';
const macros=['fr-FR', 'ja-JP', 'en-US', 'ko-KR', 'de-DE']
const userLanguages= ['fr-BE'];
const availableLanguages= ['fr-FR'];
const defaultLanguage='pt';
pickLanguageAccordingToUserLanguagesWithMacrosFallback(macros,userLanguages,availableLanguages,defaultLanguage)
//output 'fr-FR';