-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #203 from JiechengZhao/main
add next_i18n
- Loading branch information
Showing
5 changed files
with
108 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import i18n from "i18next"; | ||
import { initReactI18next } from "react-i18next"; | ||
|
||
// the translations | ||
// (tip move them in a JSON file and import them, | ||
// or even better, manage them separated from your code: https://react.i18next.com/guides/multiple-translation-files) | ||
const resources = { | ||
en: { | ||
translation: { | ||
"Welcome to React": "Welcome to React and react-i18next", | ||
"Lean Game Server": "Lean Game Server translated" | ||
|
||
} | ||
}, | ||
fr: { | ||
translation: { | ||
"Welcome to React": "Bienvenue à React et react-i18next", | ||
"Lean Game Server": "Lean Game Server French" | ||
} | ||
} | ||
}; | ||
|
||
i18n | ||
.use(initReactI18next) // passes i18n down to react-i18next | ||
.init({ | ||
resources, | ||
lng: "en", // language to use, more information here: https://www.i18next.com/overview/configuration-options#languages-namespaces-resources | ||
// you can use the i18n.changeLanguage function to change the language manually: https://www.i18next.com/overview/api#changelanguage | ||
// if you're using a language detector, do not define the lng option | ||
|
||
interpolation: { | ||
escapeValue: false // react already safes from xss | ||
} | ||
}); | ||
|
||
export default i18n; |
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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