lang::message::lookup (public)

 lang::message::lookup locale key [ default ] [ substitution_list ] \
    [ upvar_level ] [ translator_mode_p ]

Defined in packages/acs-lang/tcl/lang-message-procs.tcl

This proc is normally accessed through the _ procedure. Returns a translated string for the given locale and message key. If the user is a translator, inserts tags to link to the translator interface. This allows a translator to work from the context of a web page. Messages will have %name% replaced with variables either from substitution_list, if present, or from the caller's namespace (or upvar_level's namespace). Set upvar_level to 0 and substitution_list empty to prevent substitution from happening Note that this proc does not use named parameters, because named parameters are relatively slow, and this is going to get called a whole lot on each request.

Parameters:
locale - Locale (e.g., "en_US") or language (e.g., "en") string. If locale is the empty string ad_conn locale will be used if we are in an HTTP connection, otherwise the system locale (SiteWideLocale) will be used.
key - Unique identifier for this message. Will be the same identifier for each locale. All keys belong to a certain package and should be prefixed with the package key of that package on the format package_key.message_key (the dot is reserved for separating the package key, the rest of the key should contain only alphanumeric characters and underscores). If the key does not belong to any particular package it should not contain a dot. A lookup is always attempted with the exact key given to this proc.
default (defaults to "TRANSLATION MISSING") - Text to return if there is no message in the message catalog for the given locale. This argument is optional. If this argument is not provided or is the empty string then the text returned will be TRANSLATION MISSING - $key.
substitution_list (optional) - A list of values to substitute into the message. This argument should only be given for certain messages that contain place holders (on the syntax %var_name%) for embedding variable values, see lang::message::format. If this list is not provided and the message has embedded variables, then the variable values can be fetched with upvar from the scope calling this proc (see upvar_level).
upvar_level (defaults to "1") - If there are embedded variables and no substitution list provided, this parameter specifies how many levels up to fetch the values of the variables in the message. The default is 1.
translator_mode_p (defaults to "1") - Set to 0 if you do not want this call to honor translator mode. Useful if you're not using this message in the page itself, but e.g. for localization data or for the list of messages on the page.
Returns:
A localized piece of text.
Authors:
Jeff Davis <davis@xarg.net>
Henry Minsky <hqm@arsdigita.com>
Peter Marklund <peter@collaboraid.biz>
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_locale_language_fallback locale_language_fallback (test acs-lang) lang::message::lookup lang::message::lookup test_locale_language_fallback->lang::message::lookup ad_conn ad_conn (public) lang::message::lookup->ad_conn ad_log ad_log (public) lang::message::lookup->ad_log lang::message::cache lang::message::cache (public) lang::message::lookup->lang::message::cache lang::message::format lang::message::format (public) lang::message::lookup->lang::message::format lang::message::message_exists_p lang::message::message_exists_p (public) lang::message::lookup->lang::message::message_exists_p Class ::xowiki::formfield::FormField Class ::xowiki::formfield::FormField (public) Class ::xowiki::formfield::FormField->lang::message::lookup _ _ (public) _->lang::message::lookup auth::local::registration::Register auth::local::registration::Register (private) auth::local::registration::Register->lang::message::lookup forum::format::reply_subject forum::format::reply_subject (public) forum::format::reply_subject->lang::message::lookup lang::message::check lang::message::check (public) lang::message::check->lang::message::lookup

Testcases:
locale_language_fallback
[ show source ]
Show another procedure: