Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

accept-language

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accept-language - npm Package Compare versions

Comparing version 2.0.7 to 2.0.8

2

package.json
{
"name": "accept-language",
"version": "2.0.7",
"version": "2.0.8",
"description": "HTTP Accept-Language parser for node",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -41,8 +41,20 @@ accept-language [![Build Status](https://travis-ci.org/tinganho/node-accept-language.png)](https://travis-ci.org/tinganho/node-accept-language)

### Recommended usage with L10ns:
L10ns is an internationalization workflow and formatting tool. This library was specifically built for [L10ns](http://l10ns.org). L10ns is a very good alternative to Gettext and all of it's tooling support–XGettext, PoEdit, custom libraries etc.
[L10ns][] is an internationalization workflow and formatting tool. This library was specifically built for [L10ns](http://l10ns.org). [L10ns][] is a very good alternative to Gettext and all of it's tooling support–XGettext, PoEdit, custom libraries etc.
### API
#### acceptLanguage.languages(Array languageTags);
Define your language tags in highest priority comes first. The language tags must comply with [BCP47 standard](https://tools.ietf.org/html/bcp47). I.e. all language tags `en`, `en-US` and `zh-Hant-TW` are working.
Define your language tags ordered in highest priority comes first fashion. The language tags must comply with [BCP47][] standard. The [BCP47][] language tag consist of at least the following subtags:
1. A language subtag (`en`, `zh`).
3. A script subtag (`Hant`, `Latn`).
2. A region subtag (`US`, `CN`).
Then language tag has the following syntax:
```
language[-script][-region]
```
Which makes the following language tags `en`, `en-US` and `zh-Hant-TW` all [BCP47][] compliant. Please note that the script tag refers to language script. Some languages use two character sets instead of one. Chinese is a good example of having two character sets instead of one–it has both traditional characters and simplified characters. And for popular languages that uses two or more scripts please specify the script subtag, because it can make an i18n library fetch more specific locale data.
```javascript

@@ -63,3 +75,12 @@ acceptLanguage.languages(['en-US', 'zh-CN']);

```
### Maintainer
Tingan Ho [@tingan87][]
### License
MIT
[L10ns]: http://l10ns.org
[BCP47]: https://tools.ietf.org/html/bcp47
[@tingan87]: https://twitter.com/tingan87
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc