| Summary: | Safari's Intl.NumberFormat does not support formatting of MYR (Malaysian) currencies | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | jamespangmunwai | ||||
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> | ||||
| Status: | RESOLVED INVALID | ||||||
| Severity: | Normal | CC: | karlcow, ysuzuki | ||||
| Priority: | P2 | ||||||
| Version: | Safari 16 | ||||||
| Hardware: | Mac (Intel) | ||||||
| OS: | macOS 12 | ||||||
| Attachments: |
|
||||||
James,
I get the same result in Firefox and Safari.
but the code for Malaysia is ms-MY
so it should be either:
const formatter = new Intl.NumberFormat("ms-MY", {…
OR
const formatter = new Intl.NumberFormat("ms", {…
nope?
https://www.loc.gov/standards/iso639-2/php/langcodes_name.php?iso_639_1=ms
my is the code for Burmese
https://www.loc.gov/standards/iso639-2/php/langcodes_name.php?iso_639_1=my
Bug in Chrome?
This is V8's bug. V8 is not supporting "MY" locale, and falling back to en-US.
```
const formatter = new Intl.NumberFormat("MY", {
style: 'currency',
currency: "MYR",
currencyDisplay: 'narrowSymbol',
minimumFractionDigits: 0,
maximumFractionDigits: 0
});
print(JSON.stringify(formatter.resolvedOptions()));
print(formatter.format(123));
```
JSC
$ VM=~/dev/OpenSource/WebKitBuild/Debug; DYLD_FRAMEWORK_PATH=$VM $VM/jsc tmp/test.js
{"locale":"my","numberingSystem":"mymr","style":"currency","currency":"MYR","currencyDisplay":"narrowSymbol","currencySign":"standard","minimumIntegerDigits":1,"minimumFractionDigits":0,"maximumFractionDigits":0,"useGrouping":"auto","notation":"standard","signDisplay":"auto","roundingMode":"halfExpand","roundingIncrement":1,"trailingZeroDisplay":"auto","roundingPriority":"auto"}
၁၂၃ RM
V8
$ v8 tmp/test.js
{"locale":"en-US","numberingSystem":"latn","style":"currency","currency":"MYR","currencyDisplay":"narrowSymbol","currencySign":"standard","minimumIntegerDigits":1,"minimumFractionDigits":0,"maximumFractionDigits":0,"useGrouping":"auto","notation":"standard","signDisplay":"auto","roundingMode":"halfExpand","roundingIncrement":1,"trailingZeroDisplay":"auto","roundingPriority":"auto"}
RM 123
SpiderMonkey
$ sm tmp/test.js
{"locale":"my","numberingSystem":"mymr","style":"currency","currency":"MYR","currencyDisplay":"narrowSymbol","currencySign":"standard","minimumIntegerDigits":1,"minimumFractionDigits":0,"maximumFractionDigits":0,"useGrouping":"auto","notation":"standard","signDisplay":"auto","roundingMode":"halfExpand","roundingIncrement":1,"trailingZeroDisplay":"auto","roundingPriority":"auto"}
၁၂၃ RM
thanks @karl and @yusuke for the support! In conclusion, our side has made a mistake to use MY instead of ms-MY for malaysia, and seems like chrome v8 does not support MY and falls back to en-US |
Created attachment 464622 [details] Safari console replication of formatting MYR currencies with Intl.NumberFormat Hi team, currently Safari's Intl.NumberFormat does not seem to support MYR currencies, the `format` function outputs weird symbols. For e.g. ```js const formatter = new Intl.NumberFormat("MY", { style: 'currency', currency: "MYR", currencyDisplay: 'narrowSymbol', minimumFractionDigits: 0, maximumFractionDigits: 0 }); formatter.format(123); // output is ၁၂၃ RM, instead of RM123 ``` Note that Chrome is formatting correctly and does not have this output.