JavaScript is used all over the world in a wide variety of environments, platforms and contexts. Portability issues arise when moving between platforms. They are also present when relocating a platform geographically. At the very least a time setting will need to change, and to record an event in a coordinated time framework, the offset from that known time reference needs to be known. There will be cultural, language and currency changes necessary as well as number formatting rule variations that need to be taken account of.
Indeed the differences in some locales may completely change the native alphabet that the user is prepared to work with. Even the direction of the text flow may change in extreme circumstances. Moving around Europe certainly requires that different accented symbols be used in each country.
Fortunately the Unicode standard covers a great many of these national variants.
Even so, JavaScript is fundamentally based on the American English language and even with the international support of the Unicode character set, the structural layout of the script source text may still conform to the underlying English language form. Even so there are issues with the spelling of words such as Color.
Typically, a localized implementation may allow the use of accented and national characters in identifier names but would still retain the English spelled keywords and punctuation characters.
As well as character sets, the issue of collation into the correct sorting sequence needs to be managed properly. In JavaScript, this issue is largely confined to the way that Array objects manage their sort() method's behavior.
Date and time formats tend to be arranged differently in each country. The United States and the United Kingdom commonly place the day number and month number the opposite way round. For day numbers above 12, this can be detected automatically but otherwise the context needs to be examined to decide which way round these values are.
Numeric formats may dictate a different punctuation symbol to be used for the decimal point and thousands separator. Confusingly, the comma and period characters may be used in both contexts. This means that a value could be misinterpreted and might yield a result that is several orders of magnitude in error when parsed.
Currency symbols will need some attention. The United States dollars symbol is in the lower 128 character set. The cents symbol is not. The UK pounds symbol is within the lowest 255 characters.
Be careful of the following:
Date formats
Time settings
Character sets
Currency symbols
Sort ordering
Decimal points and thousands separators
The entire concept and scope of localization of JavaScript is being discussed as part of the standardization project. This area is prone to change or, at the very least, some definition of a standard conforming behavior.
| Prev | Home | Next |
| Locale-specific behavior | Up | location |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. | ||