- Home
- Forum
- Angular - EJ 2
- Localization for UK not working
Localization for UK not working
I am trying to format currency column of the data grid as GBP. Below is my approach-
import { L10n, setCulture, setCurrencyCode } from '@syncfusion/ej2-base';
setCulture('en-GB');
setCurrencyCode('GBP');
But still column are rendered with US dollar($) . Please suggest how to achieve this.
SIGN IN To post a reply.
1 Reply
SK
Sujith Kumar Rajkumar
Syncfusion Team
July 9, 2021 10:11 AM UTC
Hi Dipesh,
Greetings from Syncfusion support.
Based on the query we would like to let you know that for globalizing the number(including currency formats) and date values you need to load the corresponding culture files from the ‘cldr-data’ package in addition to setting the required currency code in the base’s setCurrencyCode method.
So for globalizing the currency and date values in your application’s EJ2 Grid(according to the culture set), you need to set the required culture using the EJ2 base’s setCulture method and the required currency format using its setCurrencyCode method. Then, you need to load the following culture files from the cldr-data of the ’node modules’ – ['ca-gregorian.json', 'numbers.json', 'currencies.json', 'timeZoneNames.json'] from the required culture(In your case – ‘en-GB’) present inside the main folder and the ['numberingSystems.json''weekData.json'(For calendar rendered on Grid filtering)] file from the supplemental folder in your application using EJ2 base’s loadCldr method.
This is demonstrated in the below code snippet,
|
declare var require: any
import { loadCldr, setCulture, L10n, setCurrencyCode } from '@syncfusion/ej2-base';
setCulture('en-GB');
setCurrencyCode('GBP');
loadCldr(require('cldr-data/main/en-GB/currencies.json'),
require('cldr-data/main/en-GB/numbers.json'),
require('cldr-data/main/en-GB/ca-gregorian.json'),
require('cldr-data/main/en-GB/timeZoneNames.json'),
require('cldr-data/supplemental/numberingSystems.json'),
require('cldr-data/supplemental/weekData.json')
); |
You can also localize the default text content of the Grid by loading the translation texts for the required culture from the “@syncfusion/ej2-locale” package by using the base’s L10n load function. This is demonstrated in the below code snippet for ‘en-GB’ culture,
|
declare var require: any
import { L10n } from '@syncfusion/ej2-base';
L10n.load(require('@syncfusion/ej2-locale/src/en-GB.json')); |
NPM package: https://www.npmjs.com/package/@syncfusion/ej2-locale
List of locale texts for supported cultures which can be loaded for the EJ2 controls can be checked in the below link,
Locale texts: https://github.com/syncfusion/ej2-locale/tree/master/src
We have prepared a sample based on this for your reference. You can find it below,
More details on the globalization and localization for EJ2 Grid can be checked in the below help documentation links,
Documentation: https://ej2.syncfusion.com/angular/documentation/grid/global-local/#internationalization
Please get back to us if you require any further assistance.
Regards,
Sujith R
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
DN Dipesh Nayak
- Jul 8, 2021 12:28 PM UTC
- Jul 9, 2021 10:11 AM UTC