Change language and Currency format

Hi,

My system language is spanish and Id like to change some words in the grid.
Currently I was able to change " Edit " but I wasnt able to change CSV Export.


My code:

In the grid I added:

locale='es-ES'

Then my code
import Vue from 'vue'
import { L10n, setCulture } from '@syncfusion/ej2-base';

//
setCulture('es-ES');

//
L10n.load({
'es-ES': {
'grid': {
'Edit': 'Editar',
'CSV Export': 'Exportar a CSV'
}
}
});
What do I need to do ? 


Aditionally Id like to change currency format to Spanish where decimal is a comma.
Example: 2.000,56

Many Thanks



3 Replies 1 reply marked as answer

TS Thiyagu Subramani Syncfusion Team September 1, 2020 11:40 AM UTC

Hi Carlos, 

Thanks for contacting Syncfusion forum. 

Query : I was able to change " Edit " but I wasn’t able to change CSV Export text based on Spanish culture. 

We checked your code example and found that you have used wrong translation text like CSV Export instead of Csvexport. So, we suggest you to refer the below modified code and sample link. 

L10n.load({ 
  "es-ES": { 
    grid: { 
      Add: "Añadir", 
      Edit: "Editar", 
      Cancel: "Cancelar", 
      Update: "Actualizar", 
      Delete: "Eliminar", 
      Print: "Impresión", 
      Pdfexport: "Exportar PDF", 
      Excelexport: "Exportación Excel", 
      Wordexport: "Exportación de palabras", 
      Csvexport: "Exportar a CSV" 
    } 
  } 
}); 


  
 
Query -2 : Change currency format to Spanish where decimal is a comma. 
 
Based on your shared information we have validated Spanish currency code format in below links. By default the Spain currency format as EURO (comma before dot - Ex:  #,###.##). So in this above sample we have applied currency code as ‘EUR’ in setCurrencyCode 
  
                             : https://www.thefinancials.com/Default.aspx?SubSectionID=curformat 

But in your provided example you have used comma after dot. So please ensure that. If we misunderstood your requirement, please provide more information on that. 

Please get back to us, if you need any further assistance. 

Regards, 
Thiyagu S. 



CA Carlos Alarcon September 2, 2020 01:25 PM UTC

Ok, thanks. I was able to change the language :) .

Regarding to the currency Im using CLP (Chilean Peso), which is #.###,## 
Example: 2.990,00

I tried with your example with no success. 
See this code:

Many thanks!


TS Thiyagu Subramani Syncfusion Team September 3, 2020 12:36 PM UTC

Hi Carlos , 

Thanks for your update. 

We would like to inform you that applying locale will through L10n, so it will change only the default texts of Grid component. If you need to apply the culture to the number and date formats we need to refer the json files for number, date fields through loadCldr method. You can get these files by running the following npm command, 

npm i cldr-data 

Once installed copy these files – ['ca-gregorian.json', 'numbers.json', 'currencies.json' ] from the required culture present inside the main folder to your sample. Then use the following code to load these files in the application, 

import * as currencies from "./currencies.json"; 
import * as gregorian from "./ca-gregorian.json"; 
import * as numbers from "./numbers.json"; 
loadCldr(currencies, gregorian, numbers); 

Vue.use(GridPlugin); 
setCulture("es"); 
setCurrencyCode("CLP"); 



Screenshot:  

 


You can obtain the JSON files for globalization from the NPM package named cldr data. Please refer the below  documentation for more information. 


Please let us know, if you need further assistance. 

Regards, 
Thiyagu S. 


Marked as answer
Loader.
Up arrow icon