We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set localized string to Xamarin.Forms SfImageEditor

Platform: Xamarin.Forms |
Control: SfImageEditor |
Published Date: July 3, 2019 |
Last Revised Date: July 3, 2019
Tags: localization

The SfImageEditor control supports localization. You can localize the contents of image editor by adding equivalent localized strings. By default, the image editor control is available in English.

You can localize the text from .NET Standard by adding equivalent localized strings in the resource file. Add the required resx files with Build Action > EmbeddedResource (file name must contain culture code) under the Resources folder.

E.g., for Japanese, filename should be Syncfusion.SfImageEditor.XForms.ja-JP.resx.

Initialize a new instance of the ResourceManager class that looks up resources with the specified root name in the given assembly.

C#

DependencyService.Get<ILocalize>().SetLocale("ja-JP");
            imageeditor.Source = ImageSource.FromResource("ImageEditor_SimpleSample.image3.png",GetType().GetTypeInfo().Assembly);
            ImageEditorResourceManager.Manager =
              new ResourceManager("ImageEditor_SimpleSample.Resources.Syncfusion.SfImageEditor.XForms", GetType().GetTypeInfo().Assembly);

 

The following code snippet demonstrates how to set current culture for each platform by using DependencyService.

Android:

C#

        public void SetLocale(string language)
        {
            var userSelectedCulture = new CultureInfo(language);
            Thread.CurrentThread.CurrentUICulture = userSelectedCulture;
        }

 

iOS:

C#

        public void SetLocale(string language)
        {
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(language);
 
        }

 

UWP:

C#

        public void SetLocale(string language)
        {
            CultureInfo.CurrentUICulture = new CultureInfo(language);
            CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(language);
        }

 

Sample location: https://github.com/SyncfusionExamples/How-to-set-localizad-string-to-SfImageEditor

 

Output:

 

Localized string using xamarin SfImageEditor

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile