Articles in this section
Category / Section

How to set localized string to Xamarin.Forms SfImageEditor

1 min read

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

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied