You call locale() (note the ‘e’) as described, supplying the relevant locale string. I do note that the article states:
Note that changing the locale() can be fairly time-consuming, as lots of machinery must be torn down and rebuilt for each change.
I take that to not 'just ’ change locale back and forth for casual reasons. I suspect your usage falls into the latter.
I better answer really needs more info as to the context. The following approach seems easier. I’m in UK locale so I’ll set a ‘price’ in USD:
var:number vNum = $MyNumber.format("2");
$Text = "$"+ vNum.format("l"); // '$4,525.35'
I tried chaining .format() calls but it didn’t work So, we first make a two-DP number variable, then use locale-dependent styling. We could as easily add USD instead:
var:number vNum = $MyNumber.format("2");
$Text = vNum.format("l")+" USD"; // 4,525.35 USD
But if you want Euros in German delimiters, i.e. €4.525,35
not English-style €4,525.35
then you would need to change active locale as .format("l")
is locale dependent for things like thousands separators and decimal separator. Also bear in mind, locale is accessing the users localisation settings for the given locale so if the user has for any reason further customised their per-locale setting, results may vary. But, that’s the whole point on different locale. Diversity FTW!
Bottom line, I don’t think there is an answer as simple as you were hoping for.