🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

browser-language-auto-detector

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-language-auto-detector

Auto-detect language name for browser , turn origin code to language name,whether RTL and more ,TS supported

2.0.5
latest
npm
Version published
Weekly downloads
2
Maintainers
2
Weekly downloads
 
Created
Source

browser-language-auto-detector

NPM version NPM downloads

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

Keywords

browser

FAQs

Package last updated on 17 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts