Update:Remora Localization

From MozillaWiki
Revision as of 23:12, 23 October 2006 by Wenzel (talk | contribs) (gettext tagging)
Jump to navigation Jump to search

L10n standards

see the Remora standards page on l10n.

gettext tagging

Use php's gettext functions to make localized strings, for example:

echo _('error_empty_glass');

To do string replacement, use sprintf like this:

echo sprintf(_('error_glass_refill'), $beer);

Localizers can then translate it similar to:

Some more %s was ordered.

and PHP will put in the value of $beer for %s.

Updating locales

extracting

After l10n strings have been added to the code files/views, they have to be extracted. There's a shell script that goes through the controllers, models and views (.php and .thtml files) and searches for gettext strings. The extracted strings are stored into ./messages.po .

Execute from the app dir:
./locale/extract-po.sh

merging

To bring the respective .po files of the individual locales up to date, execute from the app directory:

./locale/merge-po.sh messages.po ./locale
where messages.po is the file created by the extraction step and ./locale is the directory in which all the locales lie. The merge script will merge the new strings from messages.po into every *.po file underneath ./locale, then.