@arianee/iso-language-picker

0.5.0 • Public • Published

Build Status npm version

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';

Readme

Keywords

none

Package Sidebar

Install

npm i @arianee/iso-language-picker

Weekly Downloads

180

Version

0.5.0

License

ISC

Unpacked Size

24.3 kB

Total Files

12

Last publish

Collaborators

  • benjamin.darthout
  • 6ssou
  • 0xwhiteleaf.eth
  • max.teiger
  • gnarco
  • stefdelecjs
  • mvaullerin
  • arianeetech