Operator Scope of Action:
Operator First Added:
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.
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 macOS.
To return to the user's preferred locale, i.e. as derived from their Mac's OS account, use
You may also save the old locale in an attribute for subsequent use. For example:
…do various things…
Note that changing the locale() can be fairly time-consuming, as lots of machinery must be torn down and rebuilt for each change.