-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 #10622 from ethereum/staging
- Loading branch information
Showing
178 changed files
with
40,177 additions
and
27,118 deletions.
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,41 @@ | ||
import i18n, { Resource } from "i18next" | ||
import { initReactI18next } from "gatsby-plugin-react-i18next" | ||
|
||
export const baseLocales = { | ||
en: { title: "English", left: "En" }, | ||
zh: { title: "中国人", left: "Zh" }, | ||
ru: { title: "Русский", left: "Ru" }, | ||
uk: { title: "українська", left: "Uk" }, | ||
} | ||
|
||
// Only i18n files named in this array are being exposed to Storybook. Add filenames as necessary. | ||
const ns = ["common", "page-about", "page-upgrades", "page-developers-index"] | ||
const supportedLngs = Object.keys(baseLocales) | ||
|
||
/** | ||
* Taking the ns array and combining all the ids | ||
* under a single ns per language, set to the default of "translation" | ||
*/ | ||
const resources: Resource = ns.reduce((acc, n) => { | ||
supportedLngs.forEach((lng) => { | ||
if (!acc[lng]) acc[lng] = {} | ||
acc[lng] = { | ||
translation: { | ||
...acc[lng].translation, | ||
...require(`../src/intl/${lng}/${n}.json`), | ||
}, | ||
} | ||
}) | ||
return acc | ||
}, {}) | ||
|
||
i18n.use(initReactI18next).init({ | ||
debug: true, | ||
fallbackLng: "en", | ||
interpolation: { escapeValue: false }, | ||
react: { useSuspense: false }, | ||
supportedLngs, | ||
resources, | ||
}) | ||
|
||
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
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
Oops, something went wrong.