Update:Remora Localization: Difference between revisions
Jump to navigation
Jump to search
(extracting and merging .po files) |
m (gettext tagging) |
||
| Line 1: | Line 1: | ||
== L10n standards == | == L10n standards == | ||
see the [[Update:Remora Standards#l10n|Remora standards page on l10n]]. | see the [[Update:Remora Standards#l10n|Remora standards page on l10n]]. | ||
== gettext tagging == | |||
Use php's [http://php.net/gettext gettext] functions to make localized strings, for example: | |||
: <code>echo _('error_empty_glass');</code> | |||
To do string replacement, use [http://php.net/sprintf sprintf] like this: | |||
: <code>echo sprintf(_('error_glass_refill'), $beer);</code> | |||
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 == | == Updating locales == | ||
Revision as of 23:12, 23 October 2006
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.pois the file created by the extraction step and./localeis 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.