tree: e1de3a8e8085c309b6af2e14c763a4b24a1dbf23 [path history] [tgz]
  1. Makefile
  2. README.md
  3. make_e2e_unittest.py
  4. po-header
  5. po_check_unittest.py
  6. zh-CN.po
po/README.md

Localization for ChromeOS Factory Software

This folder contains translated resources for labels and messages used in ChromeOS factory software, in GNU gettext format.

Usage

There are several different scenarios that would involve text translations. This shows the workflow for each scenario.

Modifying code in public repository

  1. Write codes, and mark text that need to be translated by _("Translatable text"). For static HTML, label tags that need to be translated by class i18n-label.
  2. Run make update inside this directory.
  3. Edit ${LOCALE}.po. For each new / changed text, translate them accordingly inside the .po file.
  4. Commit the code changes together with .po file changes.

Modifying code in board overlay

  1. Write codes, and mark text that need to be translated by _("Translatable text"). For static HTML, label tags that need to be translated by class i18n-label.
  2. Run make update BOARD=board inside this directory.
  3. Edit po/${LOCALE}.po in board overlay. For each new / changed text, translate them accordingly inside the .po file.
  4. Commit the code changes together with .po file changes.

Adding translations for a new locale in public repository

  1. Run make init LOCALE=xx-YY inside this directory, where xx-YY is the new locale to be translated to. (e.g. zh-CN).
  2. A new xx-YY.po would be generated. Edit the file and add translations.
  3. Commit the new .po file.

Adding translations for a locale that exists in public repository into board overlay

  1. Run make update BOARD=board inside this directory.
  2. Edit po/${LOCALE}.po in board overlay and add translations. The .po file would only contain text extracted from files in board overlay.
  3. Commit the new .po file.

Adding translations for a new locale that would only exist in board overlay

  1. Run make init BOARD=board LOCALE=xx-YY inside this directory , where xx-YY is the new locale to be translated to. (e.g. zh-CN).
  2. A new po/xx-YY.po would be generated in board overlay, which would contains all text extracted from both public repository and board overlay. Edit the file and add translations.
  3. Commit the new .po file.

Note

For ease of writing pytests, if the first argument of some functions need to be passed to _(), the _() call can be omitted.

Currently, the functions that have this behavior are cros.factory.test.i18n.test_ui.MakeI18nLabel, cros.factory.test.i18n.test_ui.MakeI18nLabelWithClass.

This means that one can write MakeI18nLabel('{var} text', var=1) instead of MakeI18nLabel(_('{var} text'), var=1).

More functions may be added later if found useful.