Localisation support in legacy browsers is poor. Originally, this was due to phrases in the ECMAScript language spec that look like this:
Produces a string value that represents the value of the Number formatted according to the conventions of the host environment's current locale. This function is implementation-dependent, and it is permissible, but not encouraged, for it to return the same thing as .
Every localisation method defined in the spec is defined as "implementation-dependent", which results in a lot of inconsistencies. In this instance, Chrome Opera and Safari would return the same thing as
. Firefox and IE will return locale formatted strings, and IE even includes a thousands separator (perfect for currency strings). Chrome was recently updated to return a thousands-separated string, though with no fixed decimal.
, the , a new standard that complements the ECMAScript Language spec, provides much better support for string comparison, number formatting, and date and time formatting; it also fixes the corresponding functions in the Language Spec. An introduction can be found . Implementations are available in:
· Chrome 24
· Firefox 29
· Internet Explorer 11
· Opera 15
Determining the user's preferred language remains a problem, since there's no specification for obtaining the current language. Each browser implements a method to obtain a language string, but this could be based on the user's operating system language or just the language of the browser:
Various libraries and plugins for localisation: