Category / Section
How to localize the labels in Xamarin.Forms Chart?
1 min read
You can set localization for SfChart in all the platforms by adding a .resx file in a .NET Standard project alone. The following steps describe how to set localization for SfChart in a project and you can download the complete sample here.
- Add a new folder in the .NET Standard project named Resources.
- Add resource files for the languages you wish to support and set their Build Action to EmbeddedResource. The name of the resource file should be $name of the Syncfusion component$+$language code$+.resx. For example, if you add a resource file for French culture. Then, add the Syncfusion.SfChart.XForms.fr-FR.resx file to Resources folder as illustrated in the following screenshot.
- Provide French values for each key in the respective .resx files. Here, “Close” and “High” are the keys, and “Fermer” and “Haute” are their respective French values.
Note:
Here, resources have been already created for some cultures and shared them on the Syncfusion GitHub for your convenience.
- Set the resource manager to ‘ChartResourceManager.Manager’ to get the resource manager from the user as illustrated in the following code sample. For more details, please click here.
C#:
ChartResourceManager.Manager = new ResourceManager("GettingStarted.Resources.Syncfusion.SfChart.XForms", Application.Current.GetType().Assembly);