-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Localization Support for Jest Website #3337
Conversation
Can you rebase to master? This is nice, you're fast! |
Localization Cleanup Added a link to CrowdIn in language drop down Further cleanup, moved CrowdIn API key to environment HeaderNav fix
@thymikee I rebased and resolved a couple conflicts from my previous PR updating examples. PTAL |
Awesome, much better! |
Generated by 🚫 dangerJS |
Very cool |
uk: uk | ||
vi: vi | ||
zh-CN: zh-Hans | ||
zh-TW: zh-Hant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline please :)
@@ -0,0 +1,130 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file generated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is used to create en.js which is included in siteConfig['en'] for localization strings.
This is also our seed file for language translation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you create it? If yes, mind adding a space after colons, to make the JSON better? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cpojer Latest push has a reformatted JSON file.
Super awesome! It does seem like lint is quite unhappy, mind fixing them up using |
@cpojer I'll work through all the lint errors today! |
Added comments to generated files Worked out additional lint issues, added i18n files to ignore
* Merging TutorialAsync.md * Copied all docs from current master branch Localization Cleanup Added a link to CrowdIn in language drop down Further cleanup, moved CrowdIn API key to environment HeaderNav fix * Fixes prettier.js and other CI issues Added comments to generated files Worked out additional lint issues, added i18n files to ignore * Update .eslintignore
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
This PR adds localization support for the Jest website. It adds a new dropdown on the website to allow selecting the desired language. Localization is provided by CrowdIn. Languages shall be synchronized in the CI build step.
I have added a couple pre-processing steps: 1) strings were moved to /i18n/en.json to allow localization of string content on the landing page and from navigation. 2) I convert this json file into a .js file. These files are then included in SiteConfig.js and referenced throughout the localized pages.
The localized content is not stored in the repo. Instead, all localized content is stored on a public translation project in the Jest Crowd In project.
By default, only English is supported. Languages can be enabled as more translations are contributed by editing website/languages.js and switching the desired language's
enabled
variable totrue
.