3.0.20 • Published 3 months ago

accept-language v3.0.20

Weekly downloads
125,812
License
MIT
Repository
github
Last release
3 months ago

accept-language Build Status

NPM

accept-language parses HTTP Accept-Language header (BCP47 compliant) and returns a matched defined language.

Installation:

npm install accept-language --save

Usage:

// var acceptLanguage = require('accept-language');
import acceptLanguage from 'accept-language';
acceptLanguage.languages(['en-US', 'zh-CN']);
console.log(acceptLanguage.get('en-GB,en;q=0.8,sv'));
/*

'en-US'

*/

Usage with Express:

If you are using Express server please use the middleware express-request-language.

API

acceptLanguage.languages(Array languageTags);

Provide your language tags in order of priority. The language tags must comply with BCP47 standard.

acceptLanguage.languages(['en-US', 'zh-CN']);

acceptLanguage.get(String acceptLanguageString);

Returns the most likely language given an Accept-Language string. At least 1 language tag must be provided.

acceptLanguage.get('en-GB,en;q=0.8,sv');

Maintainer

Tingan Ho @tingan87

License

MIT

3.0.20

3 months ago

3.0.19

3 months ago

3.0.18

7 years ago

3.0.17

7 years ago

3.0.16

7 years ago

3.0.15

8 years ago

3.0.14

8 years ago

3.0.13

8 years ago

3.0.12

8 years ago

3.0.11

8 years ago

3.0.10

8 years ago

3.0.9

8 years ago

3.0.8

8 years ago

3.0.7

8 years ago

3.0.6

8 years ago

3.0.5

8 years ago

3.0.4

8 years ago

3.0.3

8 years ago

3.0.2

8 years ago

3.0.1

8 years ago

3.0.0

8 years ago

2.0.17

8 years ago

2.0.16

9 years ago

2.0.15

9 years ago

2.0.14

10 years ago

2.0.13

10 years ago

2.0.8

10 years ago

2.0.7

10 years ago

2.0.6

10 years ago

2.0.5

10 years ago

2.0.4

10 years ago

2.0.3

10 years ago

1.2.5

10 years ago

1.2.4

10 years ago

1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.11

11 years ago

1.0.10

11 years ago

1.0.9

11 years ago

1.0.8

11 years ago

1.0.7

11 years ago

1.0.6

11 years ago

1.0.5

11 years ago

1.0.4

11 years ago

1.0.3

11 years ago

1.0.2

11 years ago

1.0.0

11 years ago