-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
120 additions
and
5 deletions.
There are no files selected for viewing
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
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,27 @@ | ||
import i18n from "i18next"; | ||
import { initReactI18next } from "react-i18next"; | ||
import EN_US_TRANSLATIONS from "./i18n/en_US"; | ||
import ZH_CN_TRANSLATIONS from "./i18n/zh_CN"; | ||
|
||
// 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_US: EN_US_TRANSLATIONS, | ||
zh_CN: ZH_CN_TRANSLATIONS, | ||
}; | ||
|
||
i18n | ||
.use(initReactI18next) // passes i18n down to react-i18next | ||
.init({ | ||
resources, | ||
lng: "en_US", // 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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Resource } from "i18next"; | ||
|
||
const EN_US_TRANSLATIONS: Resource = { | ||
translation: { | ||
Problem: "Problem", | ||
User: "User", | ||
Contest: "Contest", | ||
}, | ||
}; | ||
|
||
export default EN_US_TRANSLATIONS; |
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,11 @@ | ||
import { Resource } from "i18next"; | ||
|
||
const ZH_CN_TRANSLATIONS: Resource = { | ||
translation: { | ||
Problem: "问题", | ||
User: "用户", | ||
Contest: "竞赛", | ||
}, | ||
}; | ||
|
||
export default ZH_CN_TRANSLATIONS; |
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