Skip to content
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

Merged
merged 4 commits into from
Apr 25, 2017
Merged

Add Localization Support for Jest Website #3337

merged 4 commits into from
Apr 25, 2017

Conversation

ericnakagawa
Copy link
Contributor

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 to true.

@thymikee
Copy link
Collaborator

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
@ericnakagawa
Copy link
Contributor Author

ericnakagawa commented Apr 20, 2017

@thymikee I rebased and resolved a couple conflicts from my previous PR updating examples. PTAL

@thymikee
Copy link
Collaborator

Awesome, much better!

@orta
Copy link
Member

orta commented Apr 20, 2017

Very cool

uk: uk
vi: vi
zh-CN: zh-Hans
zh-TW: zh-Hant
Copy link
Member

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 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file generated?

Copy link
Contributor Author

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.

Copy link
Member

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? :)

Copy link
Contributor Author

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.

@cpojer
Copy link
Member

cpojer commented Apr 21, 2017

Super awesome! It does seem like lint is quite unhappy, mind fixing them up using yarn lint and some manual editing?

@ericnakagawa
Copy link
Contributor Author

@cpojer I'll work through all the lint errors today!

ericnakagawa and others added 2 commits April 24, 2017 13:13
Added comments to generated files
Worked out additional lint issues, added i18n files to ignore
@cpojer cpojer merged commit 144327d into jestjs:master Apr 25, 2017
tushardhole pushed a commit to tushardhole/jest that referenced this pull request Aug 21, 2017
* 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
@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants