toLocaleString不适用于所有浏览器中小于10000的数字 [英] toLocaleString not working on numbers less than 10000 in all browsers
问题描述
我正在开发一个应用程序,该应用程序根据用户的配置显示数字.一切正常,除非在Chrome中使用以下语言环境尝试使用小于10000的数字,除非我尝试使用以下语言环境:"es-AR".有什么想法吗?
I'm working on an application, that displays numbers according to the user's configuration. Everything works as expected, except when I try with numbers less than 10000,in Chrome, with the following locale: "es-AR". Any ideas?
Chrome浏览器:
Chrome:
Firefox:
边缘:
console.log( (10000).toLocaleString("es-AR") );
console.log( (9999).toLocaleString("es-AR") );
console.log( (9999).toLocaleString("en-US") );
推荐答案
根据最新的CLDR数据,这是西班牙语语言环境的预期行为.具体而言,根据CLDR,最小分组位数"设置为 2.调查工具.
This is the intended behaviour for Spanish locales according to the latest CLDR data. Specifically the "Minimum Grouping Digits" are set to 2 according to the CLDR survey tool.
显然,Firefox和Edge要么使用了该数据的旧版本,要么还不支持该字段.
Apparently Firefox and Edge either uses an older version of that data or don't have support for that field yet.
此功能是在2014年发布的CLDR 26中引入的 ,但是像这样的增强功能需要相当长的时间才能遍及软件堆栈.
The feature was introduced in CLDR 26, which was released in 2014, but enhancements like this take quite a while to make their way through the software stack.
这篇关于toLocaleString不适用于所有浏览器中小于10000的数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!