Created
September 7, 2020 13:45
-
-
Save indreklasn/1fd20b021189571be4d4c2a6bdb516c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import i18n from "i18next"; | |
import { initReactI18next } from "react-i18next"; | |
// the translations | |
// (tip move them in a JSON file and import them) | |
const resources = { | |
en: { | |
translation: { | |
"Welcome to React": "Welcome to React and react-i18next" | |
} | |
} | |
}; | |
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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment