This directory contains the source data files for all internationalization on code.org and hourofcode.com. These files should not be directly modified; they will be regularly updated by the i18n sync scripts, which will also distribute changes out to the various locations in the repository where they will be handled.
This i18n pipeline doc contains diagrams describing how the i18n sync pipeline works.
When adding a string, please make the key as descriptive as possible because this is used as context for translators.
Make sure your string value only has plain text, Markdown-formatted text, and/or simple HTML. Try to always use plain text. If you want to add formatting, use Markdown. If you want to do something that Markdown can't do, you can add HTML.
If you want your string to support embedded HTML you must render it as Markdown.
This is because translation strings come from unstruted sources and our Markdown
renderer will remove any potentially-dangerous HTML.
You can render a string as Markdown by passing markdown: true
or markdown: :inline
to the I18n.t
method. With markdown: true
option, Markdown will handle its own
block-level elements like paragraphs and lists, while the markdown: :inline
option
will produce content suitable for embedding inside an existing block-level element.
- Update the string in the i18n Gsheet
ssh staging.code.org
and check that your changes were synced tostaging/pegasus/cache/i18n/en-US.yml
-
Add a unique key and your string value to the i18n Gsheet.
- Organization is by category/page; try to prepend each string of a common category with the same key. For example, all teacher dashboard strings begin with 'dashboard' so they're easier to find.
-
ssh into staging and check that your changes were synced to
staging/pegasus/cache/i18n/en-US.yml
For .json
files we use MessageFormat to enable formatting options such as Variables and Plurals.
- Make changes in
code-dot-org/apps/i18n/<app>/en_us.json
- If you are creating a new app:
- Add the strings in a new file in
code-dot-org/apps/i18n/<new app>/en_us.json
- Add the strings in a new file in
- Make changes in
dashboard/config/locales
. Choose from the following files depending on where it best fits categorically.en.yml
- general strings used throughout Code Studio or if it doesn't fit in any of the other filesdata.en.yml
- mostly strings related to accelerated course and video titlesdevise.en.yml
- sign in, sign up, account relatedscripts.en.yml
- course descriptions and stage names. Should be generated by editing the course on levelbuilder, but can be updated directly.slides.en.yml
- the screenshots and transcripts that accompany each tutorial videounplugged.en.yml
- titles and descriptions for unplugged levels.
Several Dashboard i18n files are updated automatically from levelbuilder content and should not be edited directly. These include:
authored_hints.en.yml
callouts.en.yml
courses.en.yml
dsls.en.yml
failure_message_overrides.en.yml
short_instructions.en.yml
long_instructions.en.yml
Many UI tests compare against strings on the page to validate expected results. Follow the instructions in the Dashboard UI Tests README to verify that the UI tests still pass after changing a string, or update them if necessary.