Operator Type:
Operator Scope of Action:
Operator Purpose:
Operator First Added:
Operator Altered:
Function [other Function type actions]
Document [operators of similar scope]
Date-time [other Date-time operators]
Baseline
locale(code)
locale(), allows changing of the locale used to translate dates. The same date can be written in a different format in different parts of the world. For example, in the USA a date is written 12/1/2006 to denote December 1, whereas in UK the same date is written 1/12/2006 and so on for variations around the world.
The action
locale("en_GB")
sets the current locale to 'British English'. Locale codes begin with a two-letter language code, followed by and underscore and a two-letter region code. These are ISO standards ISO-639 and ISO-3166 respectively. Code combinations are available for any language supported by Mac OS X.
To return to the user’s preferred locale, i.e. as derived from their Mac's OS account, use
locale();
You may also save the old locale in an attribute for subsequent use. For example:
$OldLocale=local("en_GB");
… do various things ...
local($OldLocale);
Note that changing the locale() can be fairly time-consuming, as lots of machinery must be torn down and rebuilt for each change.