Answer the question
In order to leave comments, you need to log in
How to link Redux and i18n?
Hello!
How to implement a bunch of Redux and i18n?
i18n is a library for implementing application localization (multilingualism).
When the user logs in, we must tell this library via dispatch that the user has a different language.
How to do it?
Here is the main i18n config file:
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import React from "react";
// the translations
// (tip move them in a JSON file and import them)
const resources = {
en: {
translation: {
"Главная": "Homepage",
}
}
};
i18n
.use(initReactI18next) // passes i18n down to react-i18next
.init({
resources,
lng: "en",
keySeparator: false, // we do not use keys in form messages.welcome
interpolation: {
escapeValue: false // react already safes from xss
}
});
export default i18n;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question