decanat-get-locale
v0.0.1
Published
Detect client's language preference.
Downloads
3
Readme
get-locale
Detect language preference of a page or an element.
Installation
Install with component:
$ component install decanat/get-locale
Install with npm for browserify:
$ npm install decanat-get-locale
Usage
To get preferred language getLocale
checks following sources (in order):
- HTML
lang
attribute - Cookies
navigator.language
- Default, specified in config
var getLocale = require('get-locale');
getLocale(); // 'en-US'
Testing
To test with PhantomJS, run:
$ make test
License
The MIT License