How to localize the WinForms MessageBoxAdv control?
localization
Localization is the process of making application multilingual by formatting the content according to the cultures. WinForms Message Box control can be localized in any Languages, based on application requirement by following below steps.
Step 1: Need to initialize the LocalizationProvider class, inherited from ILocalizationProvider Interface, before the InitializeComponent call in the constructor of the application.
Step 2: It will add the GetLocalizedString function in the LocalizationProvider class. In that it is needed to provide the Localization content, for the required components used in MessageBoxAdv control.
For example,
Here, MessageBoxAdv control is localized in German Language.
C#
LocalizationProvider.Provider = new Localizer(); // localizer inherits the interface ILocationProvider public class Localizer : ILocalizationProvider { #region ILocalizationProvider Members public string GetLocalizedString(System.Globalization.CultureInfo culture, string name,object obj) { switch (name) { #region MessageBoxAdv ///<summary> ///Retry Button in German Language ///</summary> case ResourceIdentifiers.Retry: return "Wiederholen"; ///<summary> ///Abort Button in German Language ///</summary> case ResourceIdentifiers.Abort: return "Abbrechen"; ///<summary> ///Ignore Button in German Language ///</summary> case ResourceIdentifiers.Ignore: return "ignorieren"; ///<summary> /// default ///</summary> default: return string.Empty; #endregion } } #endregion } //MessageBox show MessageBoxAdv.Show("Metro Theme Anpassung", "Das ist Syncfusion MessageBoxAdv Control", MessageBoxButtons.AbortRetryIgnore);
VB
LocalizationProvider.Provider = New Localizer() ' localizer inherits the interface ILocationProvider Public Class Localizer Implements ILocalizationProvider #Region "ILocalizationProvider Members" Public Function GetLocalizedString(ByVal culture As System.Globalization.CultureInfo, ByVal name As String, ByVal obj As Object) As String Implements ILocalizationProvider.GetLocalizedString Select Case name '''<summary> '''Retry Button in German Language '''</summary> Case ResourceIdentifiers.Retry Return "Wiederholen" '''<summary> '''Abort Button in German Language '''</summary> Case ResourceIdentifiers.Abort Return "Abbrechen" '''<summary> '''Ignore Button in German Language '''</summary> Case ResourceIdentifiers.Ignore Return "ignorieren" '''<summary> ''' default '''</summary> Case Else Return String.Empty End Select End Function #End Region 'MessageBox show MessageBoxAdv.Show("Metro Theme Anpassung", "Das ist Syncfusion MessageBoxAdv Control", MessageBoxButtons.AbortRetryIgnore)
Screenshot
Figure 1: localization.
Samples:
Reference link:
https://help.syncfusion.com/windowsforms/messagebox/localization
Conclusion
I hope you enjoyed learning about how to localize the WinForms MessageBoxAdv control.
You can refer to our WinForms Message Box feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms Message Box example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!