如何解决new Intl.NumberFormat() 跨浏览器以不同方式解释语言环境数组
将使用相同货币作为第一个参数的多个语言环境传递给 Intl.NumberFormat 的实例时,调用 func (input Input) Sort() []string {
var length int = LimitedAmountItems
if len(input.Media) < LimitedAmountItems {
length = len(input.Media)
}
out := make([]string,length)
start := 0
end := len(out) - 1
for i,m := range input.Media {
if i == LimitedAmountItems {
break
}
if m.IsPrincipal {
out[start] = m.URL
start++
} else {
out[end] = m.URL
end--
}
}
return out
}
时得到不同的结果。
<GeneratorScreen>:
BoxLayout:
orientation:'vertical'
size: root.width,root.height
AnchorLayout:
anchor_x: "right"
anchor_y: "top"
size: 300,root.height
BoxLayout:
orientation:'vertical'
GridLayout:
size_hint: None,None
pos_hint: {'x': .9,'y': .9}
size:200,200
cols: 3
Button:
id: settlement_button
text: 'Settlement'
font_size: 10
pos_hint: {'x': .901,'y': .87}
size_hint: None,None
size: 67,20
on_press: root.test()
Button:
id: npc_button
text: 'Npc'
font_size: 10
pos_hint: {'x': .93,20
Button:
id: npc_button
text: 'Store'
font_size: 10
pos_hint: {'x': .93,20
Button:
id: npc_button
text: 'other'
font_size: 10
pos_hint: {'x': .93,20
在 Chrome 中执行上述结果:.format()
在 Safari 中:new Intl.NumberFormat(["IL","PS"],{
style: 'currency',currency: "ILS",}).format(10);
问题似乎在于,在 Safari 中,当 Chrome 似乎基于 ₪10.00
进行格式化时,格式化程序使用代码 ۱۰٫۰۰ ₪
在使用多个语言环境时输出阿拉伯语。有没有办法将 NumberFormatter 配置为一致地应用多个语言环境来跨浏览器以相同的方式格式化数字?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。