Localization in React Chart
The Chart provides a built-in Localization library, allowing you to customize the data displayed in the chart for different languages and cultural preferences. You can easily change static text on various elements to languages such as Arabic, German, French, and more by defining the locale property and providing a translation object.
Configuration steps:
-
Choose the desired locale for your application.
-
Install the
@syncfusion/react-cldr-datapackage, which provides CLDR (Unicode Common Locale Data Repository) data for culture-specific formatting. -
Import the
L10nclass,loadCldrfunction from the@syncfusion/react-basepackage. -
Import the required localization files for your chosen language and the necessary CLDR data files:
-
Call the
loadCldrfunction with the imported data to enable formatting and parsing for the selected culture: -
Use the
L10n.loadmethod to load your translation object. -
Set the
localeproperty of the Chart to apply the selected language.
Internationalization
The Chart Internationalization library enables localized display of numbers, dates, and times based on the selected language and region. You can customize the appearance of these values by setting format strings in the format property.
The following sample demonstrates usage for en-US (English), de (German - Germany), fr-CH (French - Switzerland), ar (Arabic), and zh (Chinese - China) based on locale selection. The data in chart updates its number, date, and time formatting according to the selected culture.