4.70. setlocale
Sets locale and/or currency for the current page. Can be made persistent for the user with the 'persist' option. Resets default locale if called without arguments. See also Setting the Locale in the template documentation.
4.70.1. Summary
[setlocale]
Parameters | Description | Default |
currency |
The currency format to use.
|
DEFAULT_VALUE |
locale |
The locale to use.
|
DEFAULT_VALUE |
persist | Setting 'persist=1' also sets the scratch variables, mv_locale and mv_currency to specified locale and currency. This makes the locale settings persistent for the user's session. Otherwise (persist=0), the setlocale tag affects the remainder of the current page only. | DEFAULT_VALUE |
Attributes | Default |
interpolate (reparse) | No |
Other_Characteristics | |
Invalidates cache | no |
Container tag | No |
Has Subtags | No |
Nests | Yes |
Tag expansion example:
[setlocale] --- TODO: (tag result)
ASP-like Perl call:
$Tag->setlocale( { }, $body );
or similarly with positional parameters,
$Tag->setlocale(, $attribute_hash_reference, $body);
4.70.2. Description
Immediately sets the locale to locale, and will cause it to persist in future user pages if the persist is set to a non-zero, non-blank value. If the currency attribute is set, the pricing and currency-specific locale keys and Interchange configuration directives are modified to that locale. If there are no arguments, it sets it back to the user's default locale as defined in the scratch variables mv_locale and mv_currency.
This allows:
Dollar Pricing: [setlocale en_US] [item-list] [item-code]: [item-price]<BR> [/item-list] Franc Pricing: [setlocale fr_FR] [item-list] [item-code]: [item-price]<BR> [/item-list] [comment] Return to the user's default locale [/comment] [setlocale]
4.70.2.1. currency
The currency format to use.
- Default: [scratch mv_currency] (see also 'persist' attribute)
4.70.2.2. locale
The locale to use.
- Default: [scratch mv_locale] (see also 'persist' attribute)
4.70.2.3. persist
Setting 'persist=1' also sets the scratch variables, mv_locale and mv_currency to specified locale and currency. This makes the locale settings persistent for the user's session. Otherwise (persist=0), the setlocale tag affects the remainder of the current page only.