@os-team/i18next-tld-language-detector
The i18next language detector, which is used to detect the user's language by a top-level domain (TLD).
Usage
Install the package using the following command:
yarn add @os-team/i18next-tld-language-detector
Example of usage:
import i18next from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import HttpBackend from 'i18next-http-backend';
import { initReactI18next } from 'react-i18next';
import tldLanguageDetector from '@os-team/i18next-tld-language-detector';
const languageDetector = new LanguageDetector();
languageDetector.addDetector(tldLanguageDetector);
i18next
.use(HttpBackend)
.use(languageDetector)
.use(initReactI18next)
.init({
detection: {
order: ['cookie', 'tld'],
lookupCookie: 'lng',
caches: ['cookie'],
},
});
export default i18next;