$domain
The domain to look up the string in.
$msgid
The id of the string to look up, often the string in the C locale.
$lang
The locale to use when looking up the translated string.
$number
The cardinality for plural-form lookups.
$form
The form name for plural-form lookups.
$format
Whether to treat the result as a format string.
$node
A context node to pass to l10n.format.mode
.
$string
A string to pass to l10n.format.mode
for
This template extracts a translated version of a source string. In simple cases,
the source string is exactly the string in $msgid
, though in more complex
cases, the $msgid
parameter is a separate unique identifier.
This template looks up the translation in a message catalog file based on the
$domain
parameter. The file must be in a $domain
with
the suffix $domain
parameter.
The message catalog file format is designed to work with the XML/PO translation
tool
The message catalog file contains a set of $msgid
parameter. Each $lang
parameter,
falling back to a
In a source message catalog file, put the string to be translated inside a
singleton
The
Sometimes you have to provide different versions of a string for different
cardinalities. While English and many other languages have singular and plural,
some languages have no plural forms, while others have as many as six. These
stylesheets use a numeric index for plural forms, similarly to gettext. To get
the string for a plural, pass the cardinality in the $number
parameter. This
template gets an index for that number by calling l10n.plural.form
. The
plural form index is in the $form
parameter. You do not have to pass this
parameter. It will be computed automatically based on the $number
parameter.
There is currently no support for editing plural forms using the standard PO
syntax. Instead, plurals are defined with an XML snippet. Instead of putting
the single translated message in the l10n.plural.form
. Translators must adapt
the XML snippet according to the plural rules and forms defined in this
stylesheet for their language.
Some translations aren't simple strings, but are instead format strings where certain values are inserted. This template can handle format strings with XML marker elements to signal where values should be substituted. These values can be the result of applying templates.
To enable format strings, set the $format
parameter to l10n.format.mode
to the fragment contained in
the
The $node
and $string
parameters are passed to templates in
l10n.format.mode
. This stylesheet contains matches in l10n.format.mode
for the marker elements $string
. The
element $node
.
Text nodes are copied to the result in l10n.format.mode
.
If you need any other behavior, add elements with any name of your choosing to
the format string, then match on those elements in l10n.format.mode
. You will
be able to use the $node
and $string
parameters in your template. Try to
use a name that is unique.