FRAMES NO FRAMES | |||||||
| |||||||
SUMMARY: IMPORT | CONSTANT | MEMBER | ACTION | DETAIL: IMPORT | CONSTANT | MEMBER | ACTION |
Use the convenience functions whenever you want a translated string, eg:
L10N l10n;
action _(string message) returns string { return l10n.gettext(message); }
action _N(string singular, string plural, integer n) returns string { return l10n.ngettext(singular, plural, n); }
The L10N instance must be initialized to define the text domain and the location of the translations before use.
send Reply(l10n.printf(_("Unfortunately this didn't work for %1$s because of %1$s"), input, error)) to "output";
Action summary | |
---|---|
string |
gettext(string msgid)
Return the localized string in the appropriate language, or msgid unchanged if a translation cannot be found. |
void |
init(string textdomain)
Initialize this L10N instance for a particular textdomain using the default location for translations. |
void |
initFromPath(string textdomain, string translationsdir)
Initialize this L10N instance for a particular textdomain, reading the location of translations from an explicit path |
void |
initFromProperty(string textdomain, string translationsdirprop)
Initialize this L10N instance for a particular textdomain, reading the location of translations from a correlator property variable. |
string |
ngettext(string singular, string plural, integer n)
Return the localized string in the localized language with singular/plural selected based on a runtime parameter. If no translation is found the appropriate input parameter is returned. |
string |
printf(string format, sequence<any> args)
Use a printf-style format string to render the sequence of arguments. |
Action detail |
---|
string gettext(string msgid)Return the localized string in the appropriate language, or msgid unchanged if a translation cannot be found.
void init(string textdomain)Initialize this L10N instance for a particular textdomain using the default location for translations.
void initFromPath(string textdomain, string translationsdir)Initialize this L10N instance for a particular textdomain, reading the location of translations from an explicit path
void initFromProperty(string textdomain, string translationsdirprop)Initialize this L10N instance for a particular textdomain, reading the location of translations from a correlator property variable.
string ngettext(string singular, string plural, integer n)Return the localized string in the localized language with singular/plural selected based on a runtime parameter. If no translation is found the appropriate input parameter is returned.
string printf(string format, sequence<any> args)Use a printf-style format string to render the sequence of arguments.
Notes:
log l10n.printf(_N("Succesfully processed one %1$s", "Succesfully processed %2$d %1$ss", count), [type, count]) at INFO;
FRAMES NO FRAMES | |||||||
| |||||||
SUMMARY: IMPORT | CONSTANT | MEMBER | ACTION | DETAIL: IMPORT | CONSTANT | MEMBER | ACTION |