Confirmed users
1,209
edits
m (gettext tagging) |
No edit summary |
||
Line 1: | Line 1: | ||
= | = Localizing 101 = | ||
''Note:'' Expressions are converted to tags according to the standards mentioned at the end of the page (<code>error_blah</code> and such) so that multiple occurances of the same expression only have to be localized once. | |||
== gettext | == PHP and gettext == | ||
Use php's [http://php.net/gettext gettext] functions to make localized strings, for example: | Use php's [http://php.net/gettext gettext] functions to make localized strings, for example: | ||
: <code>echo _('error_empty_glass');</code> | : <code>echo _('error_empty_glass');</code> | ||
Line 24: | Line 24: | ||
: <code>./locale/merge-po.sh messages.po ./locale</code> | : <code>./locale/merge-po.sh messages.po ./locale</code> | ||
: where <code>messages.po</code> is the file created by the extraction step and <code>./locale</code> 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. | : where <code>messages.po</code> is the file created by the extraction step and <code>./locale</code> 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. | ||
== L10n standards == | |||
* If the string is a "widget" as defined in the shavictionary: (labels, common navigational elements like "Home" or "Top" or "Next") | |||
**element_name_additional | |||
*If the string is prose for explanations, error messages, instructions | |||
**type_name_additional | |||
*If the string is structural text like headers, titles, breadcrumbs, etc. | |||
**If the string is not in a form: | |||
***namespace_pagename_name_additional | |||
**If the string is inside of a form: | |||
***namespace_pagename_formname_element_name_additional | |||
Where: | |||
*namespace is the location in cake of the view, so if it's under /views/developers/ the namespace is "developers" | |||
*pagename is the name of the file, with underscores taken out | |||
*formname is just what you think the form should be called with "form" appended, since cake is actually naming them... (should we make this more specific?) | |||
*name is a unique name for the element (preferably its id) | |||
*element is the closest tag or parameter, so for an images alt tag it would be "alt". For a label it would be "label" | |||
*additional is anything else needed to make a string unique | |||
*type is a global category, like "error" |