Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6840149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:48:23+00:00 2026-05-26T23:48:23+00:00

Is there a JQuery Plugin available that facilitates NUMBER LOCALIZATION ? That is ,

  • 0

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 .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:48:23+00:00Added an answer on May 26, 2026 at 11:48 pm

    You could use a simple function like this one for the translation from Arabic numerals:

    function translateNumerals(input, target) {
        var systems = {
                devanagari: 2406, tamil: 3046, kannada:  3302, 
                telugu: 3174, marathi: 2406, malayalam: 3430, 
                oriya: 2918, gurmukhi: 2662, nagari: 2534, gujarati: 2790
            },
            zero = 48, // char code for Arabic zero
            nine = 57, // char code for Arabic nine
            offset = (systems[target.toLowerCase()] || zero) - zero,
            output = input.toString().split(""),
            i, l = output.length, cc;
    
        for (i = 0; i < l; i++) {
            cc = output[i].charCodeAt(0);
            if (cc >= zero && cc <= nine) {
                output[i] = String.fromCharCode(cc + offset);
            }
        }
        return output.join("");
    }
    

    And call it like this

    translateNumerals(12345, "Telugu")      // "౧౨౩౪౫"
    translateNumerals(12345, "Devanagari")  // "१२३४५"
    translateNumerals("foo", "Devanagari")  // "foo"
    

    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:

    jQuery.fn.extend({
        textTranslateNumerals: (function () {
            var translateNumerals = function (input, target) {
                // the above function
            };
            return function (target) {
                // for each selected element...
                return this.each(function () {
                    // ...look at each child node and
                    $(this).contents().each(function () {
                        // ...translate text nodes, recurse into elements
                        if (this.nodeType === this.TEXT_NODE) {
                            $(this).text(translateNumerals($(this).text(), target));
                        } else if (this.nodeType === this.ELEMENT_NODE) {
                            $(this).textTranslateNumerals(target);
                        }
                    });
                });
            };
        })()
    });
    

    EDIT #2: FWIW, here is a function that can convert from any source system into any target system:

    function translateNumerals(input, source, target) {
      var systems = {
        arabic:       48,
        devanagari: 2406, tamil: 3046, kannada:  3302, telugu: 3174, marathi:  2406,
        malayalam:  3430, oriya: 2918, gurmukhi: 2662, nagari: 2534, gujarati: 2790,
      },
      output = [], offset = 0, zero = 0, nine = 0, char = 0;
    
      source = source.toLowerCase();
      target = target.toLowerCase();
    
      if ( !(source in systems && target in systems) 
           || input == null 
           || typeof input == "undefined" || typeof input == "object" ) {
        return input;
      }
    
      input  = input.toString();
      offset = systems[target] - systems[source];
      zero   = systems[source];
      nine   = systems[source] + 9;
    
      for (var i=0, l=input.length; i<l; i++) {
        var char = input.charCodeAt(i);
    
        if (char >= zero && char <= nine) {
          output.push( String.fromCharCode(char + offset) );
        } else {
          output.push( input[i] );
        }
      }
      return output.join("");
    }
    

    Sample outputs

    translateNumerals("0123456789", "arabic", "malayalam")  // "൦൧൨൩൪൫൬൭൮൯"
    translateNumerals("൦൧൨൩൪൫൬൭൮൯", "malayalam", "arabic")  // "0123456789"
    translateNumerals("൦൧൨൩൪൫൬൭൮൯", "malayalam", "kannada") // "೦೧೨೩೪೫೬೭೮೯"
    translateNumerals("೦೧೨೩೪೫೬೭೮೯", "kannada", "nagari") // "০১২৩৪৫৬৭৮৯"
    translateNumerals("೦೧೨೩೪೫೬೭೮೯", "kannada", "gujarati") // "૦૧૨૩૪૫૬૭૮૯"
    translateNumerals("USD 13.56", "arabic", "nagari") // "USD ১৩.৫৬"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a freely available jQuery plugin that changes placeholder behavior to match HTML5
Is there a website that lists all of the publicly available JQuery plugins? Also,
Is there a jquery plugin that when you hover over an icon etc. it
Is there a jQuery plugin or javascript library that supports a genie animation effect
When writing a new jQuery plugin is there a straightforward way of checking that
I have a small jQuery plugin that I use for form AJAX validation. There
Is there any way to check if a particular plugin is available? Imagine that
so I want to use this JQuery plugin that Stack Overflow has made available
Is there some sort of utility available that will check my jQuery plugins and
I was thinking to make custom scrollbar jQuery plugin, there are many plugins available

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.