toLocaleString不适用于所有浏览器中小于10000的数字 [英] toLocaleString not working on numbers less than 10000 in all browsers

查看:105
本文介绍了toLocaleString不适用于所有浏览器中小于10000的数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,该应用程序根据用户的配置显示数字.一切正常,除非在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.

这表示分组分隔符仅在其前有2个或多个数字时使用..

显然,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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆