browser-language-auto-detector
v2.0.5
Published
Auto-detect language name for browser , turn origin code to language name,whether RTL and more ,TS supported
Downloads
18
Readme
browser-language-auto-detector
Auto-detect language name for browser , turn origin name to language name and more detail
such as english/chinese/origin translate for the language name, and whether the language is RTL(Right to Left)
detector using BCP47 collector , and common names
support TS \ UMD \ CommonJS \ ESModule
Install
//use npm
npm i browser-language-auto-detector
//use yarn
yarn add browser-language-auto-detector
Develop
install
$ yarn install
run & build
$ yarn run dev
$ yarn run build
test
$ yarn test
usage
get language name
import {getLanguageName} from 'browser-language-auto-detector'
console.log(getLanguageName());
//success
{chinese: '简体中文', origin : '简体中文', rtl: false, key: 'chinese', english: 'Chinese'}
//faild
null
get browser's origin language
import {getBrowserLocalOrigin} from 'browser-language-auto-detector'
//success
['zh-CN', 'zh', 'zh-Hans', 'en', 'und']
//faild for empty array
[]
for umd version
Please download form git release:
https://github.com/Itinysun/browser-language-auto-detector/releases
LICENSE
MIT
BUG report
Please tell us at https://github.com/Itinysun/browser-language-auto-detector/issues