Localization Made Easy for Xamarin Components | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (174).NET Core  (29).NET MAUI  (207)Angular  (109)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (41)Black Friday Deal  (1)Blazor  (215)BoldSign  (14)DocIO  (24)Essential JS 2  (107)Essential Studio  (200)File Formats  (66)Flutter  (133)JavaScript  (221)Microsoft  (119)PDF  (81)Python  (1)React  (100)Streamlit  (1)Succinctly series  (131)Syncfusion  (915)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (51)Windows Forms  (61)WinUI  (68)WPF  (159)Xamarin  (161)XlsIO  (36)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (147)Chart  (131)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (628)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (40)Extensions  (22)File Manager  (7)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (507)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (10)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (387)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (592)What's new  (332)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Localization Made Easy for Syncfusion Xamarin.Forms Components

Localization Made Easy for Xamarin Components

To reach people of different language groups, your application text should be localized for the different languages you’re targeting. This is easy to do for the text you’ve added in the application yourself. You just need to provide translated text in a language-specific .resx file. That said, your application is 100% localized only if all the text shown, including that within custom controls, is also localized. In Xamarin.Forms applications, this is already possible with Syncfusion Xamarin controls.

Previously, to localize our controls, you had to add the translated text separately for iOS, Android, and UWP in Xamarin.Forms in a separate file by following the platform-specific localization procedure. Though our users were fine with this approach, we felt that this was a little tedious. Therefore, we decided to make it simple by allowing you to localize the text by adding a .resx file in a .NET Standard project alone, which contains the App.xaml.cs file. This new approach is included in our 2018 Volume 2, SP 1 release. If you are an existing customer, don’t panic; we have implemented it with backward compatibility in mind.

This blog walks you through the steps required to localize the text in the image editor control using an .resx file. Note that the steps listed here are similar for other applicable controls.

Initial rendering

  • Download this getting started application for the image editor and open it in Visual Studio.
  • Set Android as a startup project and run it. You will get the following output in which the text of the Reset and Save buttons will be in English.
Initial Rendering of Image Editor
Image editor control with buttons in English

Add required resource files

  • 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.
  • In this example, we are going to add resource files for Spanish and Japanese cultures. Add the Syncfusion.SfImageEditor.XForms.es.resx and Syncfusion.SfImageEditor.XForms.ja.resx files.
Adding Spanish and Japanese Resource Files

Adding Spanish and Japanese resource files


  • Provide Spanish and Japanese values for each key in the respective .resx files. Here, “Reset” and “Save” are the keys, and “Reiniciar” and “Salvar” are their respective Spanish values.
.Resx File With Localized values
.Resx file with localized values

Note: We have already created resources for some cultures and shared them on the Syncfusion GitHub for your convenience.

  • Once it is done, set the resource manager to ‘ImageEditorResourceManager.Manager’. Similarly, we have specialized classes like ChartResourceManager, PopupLayoutResourceManager  etc. with property ‘Manager’ in every component to get the resource manager from the user.
ImageEditorResourceManager.Manager = new ResourceManager("GettingStarted.Resources.Syncfusion.SfImageEditor.XForms", Application.Current.GetType().Assembly);

Parameters of ResourceManager:
Specifies the fully qualified name of the resource file without its extension. In this example, “GettingStarted.Resources.Syncfusion.SfImageEditor.XForms” is the the fully qualified name of the resource file. In which,
GettingStarted – namespace in which the resource files are kept.
Resources – folder name in which the resource files are kept.
Syncfusion.SfImageEditor.XForms – name of the resource file without extension.
Specifies the assembly in which the resource files are kept. In this example, assembly is obtained using “Application.Current.GetType().Assembly”.

You can refer the ResourceManager class to know more details about it and the parameters passed in it.

Localized application

  • Build and install the application.
  • Change the language of the device to Spanish in the settings.
  • Launch the application. All the predefined English strings will be changed to Spanish strings based on the key-value pairs defined in the Syncfusion.SfImageEditor.XForms.es.resx file. You can run the application and check in other platforms as well.
Image Editor Control With Buttons In Spanish

Image editor control with buttons in Spanish


Though this works for most cultures, some require us to query the operating system on each platform to determine which language the user has selected since the supported languages and formats differ between the Android and iOS platforms with .NET Standard.
You can refer to this Microsoft documentation to learn more details about it.

Localize at the application level

We have seen how the application can be localized for the chosen language of the device. However, we can also localize the text at the application level regardless of the language selected on the device. The following platform-specific codes are needed to achieve this. Use the dependency services to set this from the .NET Standard project.

//For Android and iOS,
Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR");

//For UWP,
CultureInfo.CurrentUICulture = new CultureInfo("fr-FR");

You can download the complete sample from the Syncfusion website.

In this blog, we have manually added .resx files. However, this approach also opens a way to use the Multilingual App Toolkit to translate the text automatically.

We hope that this new approach will make the process easier to provide localization support to your application. If you have any queries, please post in the comments section below. You can also contact us through our support forum or Direct-Trac. We are always happy to assist you!

If you like this blog post, we think you’ll also like the following free e-books:

Xamarin.Forms Succinctly
Xamarin.Forms for macOS Succinctly
UWP Succinctly
Writing Native Mobile Apps in a Functional Language Succinctly


Share this post:

Comments (2)

Do we need to launch my app, everytime we change language? It works but everytime I need to force quit my app and start else it shows previous language labels.

Mohamed Samsudeen
Mohamed Samsudeen

To overcome this issue, please follow the steps given in the below documentation.


Before setting ImageEditorResourceManager.Manager, please call the below methods as mentioned.

if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Android)
var ci = DependencyService.Get().GetCurrentCultureInfo();

Comments are closed.

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed