2 <:msg:> for retrieving messages

<:msg catname msgname [lang] [fmt] [substitution_args]:>

This tag accesses a message in the catalog object previously loaded into the local variable catname with a <:catalog:> tag. If the message does not exist, the message is an empty string. The returned message is then displayed in the template output, as in a <:val:> (see section 2.1, page ) tag.

For example, you load a simple message catalog file foo/bar/mycatalog.msg with the following tag:

<:catalog foo/bar/mycatalog.msg thisCat:>

The catalog object is now loaded into the local variable thisCat. Then, to access the message under the name welcome_user, you use the tag:

<:msg thisCat.welcome_user:>

If the catalog object is a multi-lingual message catalog, you may pass the optional argument lang. If you do not specify lang, the SkunkWeb server will look for a global variable in your template called lang, and use that. You can configure your SkunkWeb server to set this global variable automatically. If SkunkWeb cannot find this global variable, it will raise an error.

For example, you load a multi-lingual message catalog file foo/bar/mycatalog.cat with the following tag:

<:catalog foo/bar/mycatalog.cat thisCat:>

The catalog object is now loaded into the local variable thisCat. Then, to access the message under the name welcome_user, for Portuguese, you use the tag:

<:msg thisCat.welcome_user lang=por:>

Alternately, if you know that the global variable lang is set properly, you can leave out the lang argument.

fmt is an optional argument, and works just like the fmt argument in the <:val:> (see section 2.1, page ) tag.

The substitution_args marker is not an argument, but instead means that any named arguments you specify will be used to do ``variable substitution'' if the message contains placeholders for variable substitution. See the variable subtitution (see section 7.3, page ) section for details.

The equivalent Python code is:

import AE.MsgCatalog
import DT.DTCommon
print AE.MsgCatalog.getMessage ( 
    catalog, msgname, lang, DT.DTCommon.ValFmtRgy[ fmt ], 
    substitution_args_as_dict )