Const
Language detector plugin for i18next
Must call initLocale before initializaing i18next
initLocale
This also sets the global locale state whenever i18next.changeLanguage is called.
i18next.changeLanguage
import i18next from "i18next";import { initLocale, detectLocale } from "@pistonite/pure/pref";initLocale({ supported: ["en", "es"], default: "en", persist: true });i18next.use(detectLocale).init({ // don't need to specify `lng` here // ...other options not shown}); Copy
import i18next from "i18next";import { initLocale, detectLocale } from "@pistonite/pure/pref";initLocale({ supported: ["en", "es"], default: "en", persist: true });i18next.use(detectLocale).init({ // don't need to specify `lng` here // ...other options not shown});
Language detector plugin for i18next
Must call
initLocale
before initializaing i18nextThis also sets the global locale state whenever
i18next.changeLanguage
is called.Example