-
Notifications
You must be signed in to change notification settings - Fork 36
I18n support and Japanese translation (jessie) #330
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
Closed
japonophile
wants to merge
37
commits into
KanoComputing:jessie
from
japonophile:japanese_translation_jessie
Closed
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
4f5e42c
Proof of concept for internationalization
japonophile 1ee50ed
Fix issue with different paths for challenge and HTML
japonophile 777ba40
GTM tag
c58d346
Merge pull request #327 from arifshanji/master
walbell cf2fb67
Continue translation of views
japonophile 2f1e044
Continue translation of views
japonophile 8fbce38
Continue translation of views and challenges
japonophile 83680aa
Translate basic challenges
japonophile 1a7374c
Translate views
japonophile 2130336
Translate documentation and views
japonophile 94340c7
Translate challenge
japonophile da29cae
Fix issue with docs. Translate medium challenges.
japonophile b7edc62
Complete translation of medium challenges
japonophile 841647c
Start translating Pixel Hack challenges
japonophile cc4519a
Finish first translation of Pong
japonophile ef94636
Push japanese translations
japonophile 957fe9e
Proof of concept for internationalization
japonophile 879dd98
Fix issue with different paths for challenge and HTML
japonophile 67fb9bc
Continue translation of views
japonophile 3bb4865
Continue translation of views
japonophile ed98fed
Continue translation of views and challenges
japonophile 303d6bd
Translate basic challenges
japonophile c40f85b
Translate views
japonophile 7a236a1
Translate documentation and views
japonophile 5aa2602
Translate challenge
japonophile b37f882
Fix issue with docs. Translate medium challenges.
japonophile 5a41d86
Complete translation of medium challenges
japonophile ca47fac
Start translating Pixel Hack challenges
japonophile 9f46d6b
Finish first translation of Pong
japonophile 41df993
Push japanese translations
japonophile b34ccea
Merge branch 'japanese_translation' of https://github.com/japonophile…
japonophile d787eb9
Add instructions regarding translations
japonophile 60f4d48
Change Pong to Pon in Japanese
japonophile 173370f
Merge remote-tracking branch 'upstream/jessie' into jessie
japonophile f5368a2
Merge branch 'jessie' into japanese_translation
japonophile 87bf19a
Merge remote-tracking branch 'upstream/jessie' into jessie
japonophile 2f9026d
Merge branch 'jessie' into japanese_translation_jessie
japonophile File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,50 @@ | ||
| # Translation | ||
|
|
||
| Translation files are found in the following directories: | ||
| - `lib/challenges/locales`: translation of the challenges | ||
| - `locales`: translation of the views | ||
| - `content/docs.json`: translation of the documentation | ||
|
|
||
| ## i18n not released yet | ||
|
|
||
| Kano OS is not fully i18n-aware and locales are not installed for end users, yet. You can translate this application, but as of now, users will still see the default English message strings. | ||
|
|
||
| ## Build | ||
|
|
||
| Translations are part of the normal build process: when you type `npm run build`, the translated challenges and docs will be copied in the `www` directory; and the view templates will be localized by mapping the resources _for each language_. So it means that all resources (views, challenges and docs translations) are prepared in advance. | ||
|
|
||
| ## Runtime | ||
|
|
||
| At runtime, the proper translation will be picked based on the browser language. | ||
|
|
||
| ## How to add a new translation | ||
|
|
||
| You need to add the new language in 3 places: | ||
|
|
||
| 1. Create `lib/challenges/locales/<lang>` and copy the whole `worlds` directory and `index.json` | ||
| These are the translations of the challenges, the main content of Make-Art. | ||
|
|
||
| 2. Create `locales/<lang>` and copy the content of `locales/en` | ||
| These are the translations of the views | ||
|
|
||
| 3. Directly edit `content/docs.json` and add your language to the map (at the top level) | ||
|
|
||
| Note that languages are identified by their 2 letter abbreviation (ignoring the country), so for example fr-FR and fr-CA will share the same translation `fr`. | ||
|
|
||
| ## How to make sure your code is i18n-aware | ||
|
|
||
| For the challenges, if you create a new challenge in English, there is nothing special to do, it can be translated to other languages by copying the .json file to the other locales directories. | ||
|
|
||
| For the views (jade templates), you need to enclose all your strings in `${{` and `}}$` as this is the convention used by gulp-html-i18n plugin to find and replace the messages in the view templates. Then, you need to add the new string to the corresponding .json file in the (top-level) `locales` directory. Let's say you want to add a string "Happy Birthday" to the challenge.jade template; you would write it as follows in the challenge.jade: `${{ challenge.hapy_birthday }}$`. Then, you would add an entry to the challenge.json map, like: | ||
| ``` | ||
| { | ||
| ... | ||
| "happy_birthday": "Happy Birthday" | ||
| } | ||
| ``` | ||
|
|
||
| Finally, for the documentation, if you add / modify text in `content/docs.json` the translations will need to be added for other languages, in the same file. | ||
|
|
||
| ## To-Do | ||
|
|
||
| Tool to make it easier to add new languages. | ||
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We are going to need to support country localisation as well. Do you think it would be particularly complicated to support that?