Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dptole/al-api
Accept-Language extra info API
https://github.com/dptole/al-api
api country http iana-subtag-registry language region
Last synced: 4 days ago
JSON representation
Accept-Language extra info API
- Host: GitHub
- URL: https://github.com/dptole/al-api
- Owner: dptole
- License: mit
- Created: 2017-11-24T05:14:30.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-25T05:21:42.000Z (almost 7 years ago)
- Last Synced: 2024-09-23T20:18:10.334Z (about 2 months ago)
- Topics: api, country, http, iana-subtag-registry, language, region
- Language: JavaScript
- Size: 121 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Accept-Language extra info API
==============================[![Build status][circle-ci-badge]][circle-ci]
[![Issue status][gh-issues-badge]][gh-issues]
[![NPM Version][npm-module-version-badge]][npm-module]
[![Downloads][npm-downloads-total-badge]][npm-module]
[![Say thanks][saythanks-badge]][saythanks-to]API for reading extra information from the HTTP header [Accept-Language][url-moz-accept-language] based on the [Language subtag registry][url-language-subtag-registry] file.
Details for the [Accept-Language][url-moz-accept-language] HTTP header can be found at the [Tags for Identifying Languages][url-rfc5646-3.1], which refers to the [Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content][url-rfc7231-3.1.3.1].
Examples
========```javascript
const al_api = require('@dptole/al-api')al_api.getLanguageDescriptionBySubtag('en') // ['English']
al_api.getRegionDescriptionBySubtag('US') // ['United States']al_api.getAcceptLanguageInfo('pt,pt-BR;q=0.9,es-VE;q=0.8')
/*
[{
'language': {
'subtag': 'pt',
'info': ['Portuguese']
}
}, {
'language': {
'subtag': 'pt',
'info': ['Portuguese']
},
'region': {
'subtag': 'BR',
'info': ['Brazil']
}
}, {
'language': {
'subtag': 'es',
'info': ['Castilian']
},
'region': {
'subtag': 'VE',
'info': ['Venezuela']
}
}]
*/
```License
=======[MIT][LICENSE]
[circle-ci]: https://circleci.com/gh/dptole/al-api
[circle-ci-badge]: https://img.shields.io/circleci/project/dptole/al-api.svg
[gh-issues-badge]: https://img.shields.io/github/issues-raw/dptole/al-api.svg
[gh-issues]: https://github.com/dptole/al-api/issues
[npm-module-version-badge]: https://img.shields.io/npm/v/@dptole/al-api.svg
[npm-module]: https://www.npmjs.org/package/@dptole/al-api
[npm-downloads-total-badge]: https://img.shields.io/npm/dt/@dptole/al-api.svg
[saythanks-badge]: https://img.shields.io/badge/say%20thanks-%E3%83%84-44cc11.svg
[saythanks-to]: https://saythanks.io/to/dptole
[url-moz-accept-language]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language
[url-rfc7231-5.3.5]: https://tools.ietf.org/html/rfc7231#section-5.3.5
[url-rfc7231-3.1.3.1]: https://tools.ietf.org/html/rfc7231#section-3.1.3.1
[url-rfc5646-3.1]: https://tools.ietf.org/html/rfc5646#section-3.1
[url-language-subtag-registry]: https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
[LICENSE]: LICENSE