# Introduction [![npm version](https://img.shields.io/npm/v/i18next-browser-languagedetector.svg?style=flat-square)](https://www.npmjs.com/package/i18next-browser-languagedetector) [![Bower](https://img.shields.io/bower/v/i18next-browser-languagedetector.svg)]() [![David](https://img.shields.io/david/i18next/i18next-browser-languagedetector.svg?style=flat-square)](https://david-dm.org/i18next/i18next-browser-languagedetector) This is a i18next language detection plugin use to detect user language in the browser with support for: - cookie (set cookie i18next=LANGUAGE) - sessionStorage (set key i18nextLng=LANGUAGE) - localStorage (set key i18nextLng=LANGUAGE) - navigator (set browser language) - querystring (append `?lng=LANGUAGE` to URL) - htmlTag (add html language tag are passed in options return 'en'; }, cacheUserLanguage(lng, options) { // options -> are passed in options // lng -> current language, will be called after init and on changeLanguage // store it }, }; ``` ### adding it ```js import LanguageDetector from 'i18next-browser-languagedetector'; const languageDetector = new LanguageDetector(); languageDetector.addDetector(myDetector); i18next.use(languageDetector).init({ detection: options, }); ``` Don't forget: You have to add the name of your detector (`myDetectorsName` in this case) to the `order` array in your `options` object. Without that, your detector won't be used. See the [Detector Options section for more](#detector-options). ---

Gold Sponsors

--- **localization as a service - locize.com** Needing a translation management? Want to edit your translations with an InContext Editor? Use the orginal provided to you by the maintainers of i18next! ![locize](https://locize.com/img/ads/github_locize.png) With using [locize](http://locize.com/?utm_source=react_i18next_readme&utm_medium=github) you directly support the future of i18next and react-i18next. ---