
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
💪 Try as hard as possible to detect the client's language tag ('locale') in node or the browser. Browserify and Webpack friendly!
Try as hard as possible to detect the client's language tag ("locale") in node or the browser. Browserify and Webpack friendly!
In 2009, IETF published RFC-5646, "Tags for Identifying Languages," in which "...describes the structure, content, construction, and semantics of language tags for use in cases where it is desirable to indicate the language used in an information object."
A language tag is composed from a sequence of one or more "subtags", each of which refines or narrows the range of language identified by the overall tag. Subtags, in turn, are a sequence of alphanumeric characters (letters and digits), distinguished and separated from other subtags in a tag by a hyphen ("-", [Unicode] U+002D)
.
References:
Tested successfully on:
✓ IE 8 ✓ IE 9 ✓ IE 10 ✓ IE 11 ✓ IE 12 (Edge)
✓ Safari 5.1+
✓ Opera (Presto, Webkit, Blink)
✓ Firefox
✓ Chrome
$ babel-node
> import locale2 from 'locale2'
> locale2
en-US
>
var iso3166 = require('iso3166-1')
var locale2 = require('locale2')
> iso3166.from(locale2).to3()
USA
>
npm install --no-optional
npm test
npm run test:bs
npm run test:bs:local
FAQs
💪 Try as hard as possible to detect the client's language tag ('locale') in node or the browser. Browserify and Webpack friendly!
The npm package locale2 receives a total of 43,554 weekly downloads. As such, locale2 popularity was classified as popular.
We found that locale2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.