Skip to content

Latest commit

 

History

History
64 lines (51 loc) · 2.03 KB

I18N.md

File metadata and controls

64 lines (51 loc) · 2.03 KB

Coding with Chrome - i18n translation

Additional language support

If your language is currently not support, create a new language file and folder under locales/[language]/translation.json.

Take a look into the locales/en/translation.json file and start translating the different type of text.

Please make sure that you only add translated text into this new file. It also fine to start with a few line and adding the rest later.

If the new file is ready, create an pull request under the following URL: https://github.com/google/coding-with-chrome/pulls

Translation of untranslated text

Perform the following steps:

  • Enable the Debug mode under Settings -> Misc - Debug mode
  • Restart the app
  • Navigate around in the UI part you want to translate
  • Open the Chrome Developer Tools inside the Coding with Chrome App
  • Go to the "hamburger" menu and click on the "Debug" icon
  • In the new window click on i18n Untranslated

This will return a list of all untranslated text for your language in the Chrome Console, like:

Found 28 untranslated text for en
File: src/locales/en/translation.js
  'Runs the code and update preview': 'Runs the code and update preview',
  'write(': 'write(',
  'Writes the text on the screen.': 'Writes the text on the screen.',
  'clear ()': 'clear ()',
...

Copy the output, add your translation and place them into the file locales/[language]/translation.json.

Missing translations

If you miss the translation for certain UI parts, please submit pull request to add them.

In JavaScript files

Use the global "i18t" function to add the translation to any text. Please keep in mind that it could be that some text is already translated by general functions.

  i18t('Some untranslated text')

In soy files

For soy files, use the {msg desc=""} {/msg} tags to mark any text. Please keep in mind that it could be that some text is translated by general functions instead directly.

  {msg desc=""}
    Welcome to Coding with Chrome!
  {/msg}