Is there a JQuery Plugin available that facilitates NUMBER LOCALIZATION ?
That is , the plugin should translate numerals into their local glyphs.
Arabic | ٤٣٢١ | 1234 Indic (Telugu/Hindi) | ౧౨౩౪౫/१२३४५ | 12345
PS : My requirement is number CONVERSION , not formatting .
You could use a simple function like this one for the translation from Arabic numerals:
And call it like this
The translation to Arabic numerals is equally simple. It requires just a little more plumbing.
The above function knows the charCode of the Zero in any target system and does some simple math to do a character-by-character conversion from Arabic numerals to that system.
A reverse function would need to check each character of the input. If it falls the charCode range of any source system (i.e. the charCode of the respective Zero + 9) it knows the required offset. Subtracting the offset will get you into the Arabic range. This is pretty trivial and I’ll leave it to you.
EDIT #1: Since you mentioned jQuery, the above could be made into a plugin like this:
EDIT #2: FWIW, here is a function that can convert from any source system into any target system:
Sample outputs