How can I help you?
Localization in Windows Forms MessageBox (MessageBoxAdv)
15 Jun 20212 minutes to read
Localization is the process of translating the application resources into different language for the specific cultures. MessageBoxAdv control can be localized in any Languages, based on application requirement by following below steps.
The following steps helps to localize the text in MessageBoxAdv:
Step 1: Include the required namespaces at the beginning of the file.
using Syncfusion.Windows.Forms;Imports Syncfusion.Windows.FormsStep 2: Need to initialize the LocalizationProvider class, inherited from the ILocalizationProvider interface, before the InitializeComponent call in the constructor of an application.
LocalizationProvider.Provider = new Localizer();Step 3: Add the GetLocalizedString function in the LocalizationProvider class in which provide the Localization content, for the required components used in MessageBoxAdv.
For example:
Here, MessageBoxAdv is localized in German Language.
MessageBoxAdv.Show(this, "Änderungen speichern?", "Datei geändert", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
// localizer inherits the interface ILocationProvider
public class Localizer : ILocalizationProvider
{
public string GetLocalizedString(System.Globalization.CultureInfo culture, string name,object obj)
{
switch (name)
{
// Yes Button in German Language
case ResourceIdentifiers.Yes:
return "Ja";
// No Button in German Language
case ResourceIdentifiers.No:
return "Nein";
// default
default:
return string.Empty;
}
}
}