3

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?)

Community
  • 1
  • 1
hippietrail
  • 15,848
  • 18
  • 99
  • 158
  • 3
    What general-purpose programming languages (not APIs/frameworks) do have locale support, and what exactly do they support? – penartur Aug 06 '12 at 10:36
  • @penartur: I don't care whether they're part of the basic language or the standard libraries that come with the languages. Feel free to improve my wording if this bothers you and I didn't say it right. I believe C, C++, Java, C#, Perl, Python, at least have locale support out of the box. – hippietrail Aug 06 '12 at 10:38
  • 1
    Again, what do you mean by a locale support? – penartur Aug 06 '12 at 10:39
  • @penartur: I mean programmatic access to the locale support of the operating system, which includes such things as country, language, date format, currency, etc. – hippietrail Aug 06 '12 at 10:41
  • Javascript with its "standard" browser library is designed to be run in a restricted browser environment; and, as such, it won't have access to the operating system locale / filesystem / etc. Some other frameworks, designed to be run in other environment (e.g. WSH or Node.js) may offer you such a support. – penartur Aug 06 '12 at 10:45
  • 1
    @penartur: Do you have some links or references to support that JavaScript "won't" have access to locale. You are aware of the **[File API](http://www.w3.org/TR/FileAPI/)** currently being added to JavaScript and already implemented to varying degrees in more recent versions of various browsers. – hippietrail Aug 06 '12 at 10:48
  • It is not a filesystem API but, rather, a way to process on the client the same data that was previously sent to the server anyway. – penartur Aug 06 '12 at 11:05

2 Answers2

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.
hippietrail
  • 15,848
  • 18
  • 99
  • 158
1

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

HTMLPDFePub

hippietrail
  • 15,848
  • 18
  • 99
  • 158