0.4.0 • Published 6 years ago

@dptole/al-api v0.4.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Accept-Language extra info API

Build status Issue status NPM Version Downloads Say thanks

API for reading extra information from the HTTP header Accept-Language based on the Language subtag registry file.

Details for the Accept-Language HTTP header can be found at the Tags for Identifying Languages, which refers to the Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content.

Examples

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

0.4.0

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago