Blogger :
MSDN Blogs
All posts :
All posts by MSDN Blogs
Category :
SAPscript
Blogged date : 2008 Apr 29
David asked:
Hi,
Does anyone know how to setLocale in Jscript? It seems like JS assumes that everything gets localized in current locale.
Also, how do we convert string “1,234” into double 1234 (taking comma into consideration)
The reason I am asking this is that I am trying to resolve a globalization issue.
I think UK locale tends to have “1.234,56” format for their currency while we have “1,234.56” for currency.
If anyone can knows how this can be resolved would be great.
The problem can easily be solved in VBScript:
--There is a SetLocale function (I just use it to test)
--And Cdbl() converts “12,34” correctly to 12.34 in UK Locale
--Also converts “1,234” correctly to 1234 in US Locale
Wondering if there’s a solution in JScript.
Thank you very much!
Luckily, inestimable developer Paul was there with the best tongue-in-cheek response this month:
You can write your conversion functions in vbscript and call them from jscript.
JScript and JavaScript (aka ECMAScript) all have in common this particular lack of the kind of support for internationalization that people like me consider to be pretty important.
It is kind of fun when the lack is described in terms less likely to lead to diatribes about that lack, which are seldom placed so as to foster a solution.
Paul's answer, on the other hand, in light of the just sipped bit Limonata, just inspires a YOMANK from me. :-)
The situation is fairly unfortunate, given how much more ubiquitous ECMAScript is, especially for client side scripting in the browser, but also in general. But no one seems eager to jump in and see it enhanced at this point....
This blog brought to you by , (U+002c, aka COMMA)