Change format number

Hi, I want to format number 1,213,123.32 to 1.213.123,32. The attached solution is not working, can you help me? Capture (5).jpg


3 Replies

MA Mohammed Ansar Sathik Ali Syncfusion Team April 12, 2022 11:04 AM UTC

Hi Andrea,


Greetings from Syncfusion support.


Query: Change format number in Italy(“it”) locale


By analyzing your query, you need to change the Currency format from default format(US dollar) to Italian Euro , We have achieved your query by using the following way.


Please refer the below code example and sample for more information.


ej.base.enableRipple(true); 

 

[import section]

import it from './it.json'; //for Italian Language

 

 ej.base.setCulture(‘it’);          // To change to the Italian Currency Format

 ej.base.setCurrencyCode('EUR');//To change the Currency symbol to Euro

 

 

 ej.base.L10n.load(it);//To set a  website or application language as Italian

 

 


Sample : https://stackblitz.com/edit/wpngdc-x2hjkx?file=index.js


Knowledge Base: https://www.syncfusion.com/kb/12946/how-to-set-different-cultures-in-javascript-and-angular-grid


Documentation: https://ej2.syncfusion.com/documentation/api/base/staticFunctions/#loadcldr


Please get back to us if you need further assistance on this.


Regards,

Mohammed Ansar.



AC andrea c April 12, 2022 12:55 PM UTC

Hello,

Thanks for your support. Actually the solution looks not working.

How can we use loadcldr without npm install (we are not using node js)?

As you can see attached in this way we are correctly translating the text into Italian.. where we have to add the code for formatting the value?

In the html we are importing Syncfusion using ej2.min.js. Is it enough or do we need to add more files?

<!--<%--@* Syncfusion Essential JS 2 Scripts *@--%>-->

    <script src="../Scripts/ej2/ej2.min.js"></script>

loading (1).png



MA Mohammed Ansar Sathik Ali Syncfusion Team April 13, 2022 02:10 PM UTC

Hi Andrea,


Since you can convert the Currency values to Euro without using NPM command. In below code example, we have achieved the Currency formatting based on locale using setCurrency method.


Please refer the below code example and sample for more information.


ej.base.enableRipple(true);

ej.base.L10n.load(

  {

    "it-IT": {

      "grid": {

        "EmptyRecord": "nessun dato da visualizzare",

        "True": "vero",

        "False": "falso",

        

      },

      "pager": {

        "currentPageInfo": "{0} di {1} pagine",

        "totalItemsInfo": "({0} articoli)",

        "firstPageTooltip": "Vai alla prima pagina",

    }

    }

  }

ej.base.setCulture('it-IT'); // Change the culture

ej.base.setCurrencyCode('EUR'); // Change the currency code

 


Sample: https://stackblitz.com/edit/wpngdc-nmgxit?file=index.js


Knowledge Base: https://www.syncfusion.com/kb/12946/how-to-set-different-cultures-in-javascript-and-angular-grid


Documentation: https://ej2.syncfusion.com/documentation/api/base/staticFunctions/#loadcldr


Regards,

Mohammed Ansar.


Loader.
Up arrow icon