The Localization in .NET MAUI Image Editor (SfImageEditor)

21 Jan 20251 minute to read

Localization is translating the application resources into different languages for specific cultures. The Image Editor can be localized by adding a resource file.

Setting CurrentUICulture to the application

Application culture can be changed by setting CurrentUICulture. in the App.xaml.cs file.

using Syncfusion.Maui.ImageEditor;
using System.Resources;

public partial class App : Application
{
	public App()
	{	    
        CultureInfo.CurrentUICulture = new CultureInfo("fr-FR");
        //// ResXPath => Full path of the resx file; For example : //SfImageEditorResources.ResourceManager = new ResourceManager
        // ("MauiImageEditorDemo.Resources.SfImageEditor", Application.Current.GetType().Assembly);

        SfImageEditorResources.ResourceManager = new ResourceManager("ImageEditorLocalization.Resources.SfImageEditor", Application.Current.GetType().Assembly);
        MainPage = new MainPage();
	}
}

Localize application level

To localize the ImageEditor based on the CurrentUICulture using resource files, follow the steps below.

  1. Add the default resource file of ImageEditor to the Resources folder of the application.

addition-of-default-resource-file-of-maui-ImageEditor-into-resources-folder

  1. Right-click on the Resources folder, select Add, and then choose NewItem.

  2. In the Add New Item wizard, select the Resource File option and name the filename as SfImageEditor.<culture name>.resx. For example, name it SfImageEditor.fr-FR.resx for the French culture.

  3. The culture name indicates the name of the language and country.

shows-the-name-of-resource-file-to-be-added-for-maui-ImageEditor

  1. Now, select the Add option to add the resource file in the Resources folder.

shows-the-added-resource-file-for-french-language-in-maui-ImageEditor

  1. Add the Name/Value pair in the Resource Designer of the SfImageEditor.fr-FR.resx file and change its corresponding value to the corresponding culture.

shows-the-added-resource-file-name-value-pair-in-the-resource-designer-in-maui-ImageEditor

NOTE

View sample in GitHub