RESOLVED INVALID 251058
Safari's Intl.NumberFormat does not support formatting of MYR (Malaysian) currencies
https://bugs.webkit.org/show_bug.cgi?id=251058
Summary Safari's Intl.NumberFormat does not support formatting of MYR (Malaysian) cur...
jamespangmunwai
Reported 2023-01-23 18:28:25 PST
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.
Attachments
Safari console replication of formatting MYR currencies with Intl.NumberFormat (88.31 KB, image/png)
2023-01-23 18:28 PST, jamespangmunwai
no flags
Karl Dubost
Comment 1 2023-01-23 19:44:40 PST
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?
Yusuke Suzuki
Comment 2 2023-01-23 20:23:43 PST
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
jamespangmunwai
Comment 3 2023-01-24 00:26:38 PST
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
Note You need to log in before you can comment on or make changes to this bug.