JavaScript Internationalization API
hacks.mozilla.org
hacks.mozilla.org
Internationalization is a notoriously difficult problem, and it's great to see some native API browser support. We definitely have a long way to go.
But there is just no way that I can src="" your .js directly into my web application and therefore access to the DOM.
Could I still use your service somehow?
I've just spent much of the past 10 days trying to think of how to internationalise and translate a web app. I'd resorted to writing my own dodgy JS client side solution, backed by something on the server side, but I'll take a good look at your solution now that I've seen it!
var ctor = "Collator"; // or the others
var instance = new Intl[ctor](locales, options);
What's the purpose "ctor" here? i.e. Why not just do "new Intl.Collator(locales, options)"? Is it just to demonstrate the other constructors have the same arguments?And I am continually amazed by how good the solutions Unicode and the CLDR provide are. It's complicated, because the domain is complicated.
Bringing these tools to JS in the browser is great.
Let's get deeper than money classes.
To give more insight: L20N is a localization format plus its backing libraries which adds some "scripting capabilities" [1] thus empowering localizers, who will be able to leverage some logic to make their localizations feel more in par/natural with the grammar rules of their target language.
The post OTOH is an overview through the implementation of the ECMAScript i18n API in Firefox, which has been available to developers since Firefox 29. As it mentions, the browser itself includes general language knowledge (think of it as system locales in a UNIX env., which knows how to format dates, times, currency etc. for a given locale), gathered from Unicode CLDR and the ICU i18n library.
[1] Check out the examples at http://l20n.org/
The fuzzy search examples they give look as though they'll save a lot of time for me. Seeing as Mozilla says it's implemented in JavaScript, I think I might see if it it's easily turned into a standalone I18n library for node.js
Now if only PhoneGap was natively implemented. At least web-based notifications from websites!
(new Date()).getTimezoneOffset()
I'd assume it's returning the system time zone offset, and for me it's correct.However, how come the time stuff isn't sorted out yet? Why do I still have to use MomentJS?
Really? Why not just use a browser-based js library?
I don't really care much about i18n and I don't think there's a library around that does all the stuff mentioned in the post but it am I missing something to assume you could solve this without server roundtrips?