Localization in Xamarin Kanban Board (SfKanban)
13 May 20211 minute to read
You can localize
SfKanban in all the platforms by adding a .resx file in a .NET Standard project alone. The following steps describe how to localize SfKanban in a project and you can download the complete sample from this
Here, the resources have been already created for some cultures and shared them on
Syncfusion GitHubfor your convenience.
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 the French culture, add the Syncfusion.SfKanban.XForms.fr-FR.resx file to Resources folder as illustrated in the following screenshot.
Provide the French values for each key in the respective .resx files. Here, “ItemsCount” and “Max” are the keys, and “Fritems” and “frmax” are their respective French values.
<data name="ItemsCount" xml:space="preserve"> <value>Fritems</value> </data> <data name="Max" xml:space="preserve"> <value>frmax</value> </data>
- Set the resource manager to ‘KanbanResourceManager.Manager’ as demonstrated in the following code to get the resource manager from the users. For more details, refer
KanbanResourceManager.Manager = new ResourceManager("GettingStarted.Resources.Syncfusion.SfKanban.XForms", Application.Current.GetType().Assembly);
Localize at application level
You can also localize the text at application-level regardless of the language selected on the device. The following platform-specific codes are needed to localize the text at application-level. Use the
DependencyServices to set this from .NET Standard project.
//For Android and iOS, Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR"); //For UWP, CultureInfo.CurrentUICulture = new CultureInfo("fr-FR");