Skip to content

Localization instructions

pekman edited this page Mar 29, 2011 · 8 revisions

Translation files

Translated strings are located in three places: Gettext translations are in locale/<locale_id>/aaltoapps.po, Rails I18n translations are in config/locales/<locale_id>.yml and longer translatable texts are in their own partials under app/views/. Gettext files contain translations for strings marked translatable with _(). Rails I18n files contain translations for strings not under application developer's control that come from Rails internal or plugin code, such as model attribute names (used in forms and form error messages).

Gettext files can be edited either with a text editor or with a specialized po-file editor. If editing with a text editor, msgid is the original English string and msgstr is the translation. Untranslated strings have an empty string in msgstr; fast_gettext will use the original English strings for these.

Rails I18n files are YAML files that contain a hierarchical structure of keys and associated translated strings. The language name shown in locale selector is under the key <locale_id>.i18n.language.name.

Longer texts are in their own partials under app/views/ with the language code as a part of their file name, e.g. _longtext.en.html.erb.

Updating Gettext files

When new translatable strings are added or existing ones changed, the Gettext files should be updated with the following command: rake gettext:find

In order for this to work, Gettext binaries must be installed. In Ubuntu this can be done with the command apt-get install gettext.