Is there any current proposal I can follow about adding proper locale support to JavaScript?

故事扮演 提交于 2019-12-07 16:38:40

问题


Even though all major operating systems and programming languages/APIs have had locale support for at least a couple of decades, it seems that JavaScript still does not!

With JavaScript becoming more and more of a full application programming language both in the browser and on the server, the lack of real locale support is becoming a real problem.

Are there any proposals to add locale support as it exists in other languages to the EcmaScript standard? As part of the "harmony" project or anywhere else? I'd like to support and evangelize any such proposal.

(This is a followup to my previous question: Is it possible to determine the user locale's country as set in the OS from the browser in JavaScript?)


回答1:


The best I have found so far is "ES Wiki": "a wiki for the ongoing specification work of Ecma TC39".

This wiki has a "globalization directory". The "Goals" section of this directory states, among other things:

Provide an API that complements the ECMAScript Language Specification with:

  • Consistent, rich internationalization API, similar to what modern operating systems and internationalization libraries have today for C++ and Java.
  • Consistent results (not 100% identical but comparable to the data collected in CLDR or the locale support on major platforms).
  • Support for multiple locales per application.
  • Identification of locales, time zones, currencies etc. using existing standards. Reuse of objects that are more expensive to create, like collators.



回答2:


I've just noticed that an official ECMAScript Internationalization API Specification was released in December 2012, possibly without making much of a commotion on the web:

Standard ECMA-402
1st Edition / December 2012

HTML • PDF • ePub



来源:https://stackoverflow.com/questions/11826566/is-there-any-current-proposal-i-can-follow-about-adding-proper-locale-support-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!