Closed Aarbel closed 4 years ago
you do not need this lib to get the browser language -> https://github.com/i18next/i18next-browser-languageDetector/blob/master/src/browserLookups/navigator.js
you can get it by using browsers navigator.languages
and similar -> this detector is used for i18next to detect languages from possible sources...
btw: i18next.language (or i18next.languages)
Thanks a lot guys !
Best solution i've found:
export const getCurrentLng = () =>
i18n.language || window.localStorage.i18nextLng || "";
This should be clearly written in the Readme @adrai
This should be clearly written in the Readme @adrai
i18n.language
is documented here: https://www.i18next.com/overview/api#language
and window.localStorage.i18nextLng
is an internal information, and does not necessarily reflect your browser language
How can i simply display the browser langage with this lib ?
I'm just looking for a simple function to ouput browser langage (an see if it's "en" or "fr") for example.