Candlepin uses gettext-commons to support internationalization.
Internally, we are using zanata for translations. The configuration is controlled by a zanata.xml file located in the po directory. You will need to set up the zanata-client package.
zanata-client is quite broken in Fedora (often) whenever dependency Java rpms are updated. Instead the authors currently recommend using the ivy setup outlined here.
The regular process for updating translations consists of extraction of resources that should be localized, providing translations, and compilation of resource bundles.
buildr gettext:extract will extract all strings in I18n.tr() calls. This
command will generate a catalogue file (keys.pot) in the po directory in the common subproject.buildr gettext:merge will merge the keys from the catalogue file into locale-specific .po files.zanata-cli push --src-dir $PWD --trans-dir $PWDzanata-cli pull --src-dir $PWD --trans-dir $PWDbuildr validate_translationbuildr validate_translation:fixpoedit (or vim, or emacs, or some other WMD) to provide translations for extracted keys.common/target/generated-source/org/candlepin/common/i18n. The file names are
Messages_LOCALE.class.zanata-cli
pull --src-dir $PWD --trans-dir $PWD --import-po (this is not normally
required). To import the po files, you need to ensure that you have merged the
keys as shown above.add a ~/.config/zanata.ini with content like:
[servers]
# "zanata" in this case is just a name for the
# server
zanata.url = https://translate.zanata.org/zanata/
zanata.username = myfedorausername
# need to generate on zanata "my profile page"
zanata.key = cfd50f51cd8ed9876f3f126a7be431bb
i18n.properties file determines the name and the package of resource
bundles.MissingResourceException.The Guice I18nProvider allows guice to inject instances of I18n into
resource classes (or other non-singleton objects managed by guice). The
provider relies on ‘Accept-Language’ http header to determine the locale.
Then (assuming instance variable name is i18n):
i18n.tr("goodbye, cruel world.");