Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/434.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我们能否仅使用Intl.NumberFormat显示阿拉伯货币符号?_Javascript_Number Formatting_React Intl - Fatal编程技术网

Javascript 我们能否仅使用Intl.NumberFormat显示阿拉伯货币符号?

Javascript 我们能否仅使用Intl.NumberFormat显示阿拉伯货币符号?,javascript,number-formatting,react-intl,Javascript,Number Formatting,React Intl,当前,如果我将货币设置为QAR,它将以英语显示为QAR,并显示为ª.ق。用阿拉伯语 console.log(new Intl.NumberFormat("en", { style: "currency", currency: "QAR", currencyDisplay: "symbol" }).format(999)); // renders "QAR 999.00"

当前,如果我将货币设置为QAR,它将以英语显示为QAR,并显示为ª.ق。用阿拉伯语

console.log(new Intl.NumberFormat("en", {
    style: "currency",
    currency: "QAR",
    currencyDisplay: "symbol"
}).format(999));
// renders "QAR 999.00" 

console.log(new Intl.NumberFormat("ar", {
    style: "currency",
    currency: "QAR",
    currencyDisplay: "symbol"
}).format(999));
// renders "ر.ق.‏ 999.00"
如果我将货币设置为美元,它将在英语中显示为美元,在阿拉伯语中显示为美元

console.log(new Intl.NumberFormat("en", {
    style: "currency",
    currency: "USD",
    currencyDisplay: "symbol"
}).format(999));
//renders "$999.00"

console.log(new Intl.NumberFormat("ar", {
    style: "currency",
    currency: "USD",
    currencyDisplay: "symbol"
}).format(999));
//renders "US$ 999.00"
我个人不会说阿拉伯语,但我已经得到了阿拉伯语美元的翻译,即“ar”,如果语言是“ar”,货币是“USD”,那么它会将“US$”改为“US$”(例如,“US$”),我在文档中找不到任何东西

提前谢谢


tldr:当语言设置为“ar”时,我想显示“ar”,而不是美元,或者知道仅仅使用Intl.NumberFormat是否不可能。在对Intl.NumberFormat进行了更多修改后,我发现
currencyDisplay
可以设置为
name
,这将解决我的问题