)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to localize the navigation pane button text in WinForms GroupBar?

Platform: WinForms |
Control: GroupBar |
Published Date: May 15, 2018 |
Last Revised Date: January 2, 2020 |
.NET Framework: 4

Localize the navigation pane button text

In GroupBar control, NavigationPane button text can be localized to any Language. Below steps helps to provide the localization for NavigationPane button text.

 

Step 1: Need to initialize the LocalizationProvider class, inherited from the ILocalizationProvider interface.

Step 2: Need to add the GetLocalizedString function in the LocalizationProvider class. It is used to provide the localized content for the options in NavigationPane of GroupBar.

Here, NavigationPane button text is localized in Arabic Language. The following code demonstrates the same.

 

C#

//Codes in Form1.cs
LocalizationProvider.Provider = new localizer();
 
//For Arabic Language
CultureInfo Arabic = new CultureInfo("ar");
LocalizationProvider.Provider = new Localizer(Arabic);
 
 
class Localizer : ILocalizationProvider
{
  CultureInfo CustomCulture;
  #region ILocalizationProvider Members
  public Localizer()
  {
  }
  public Localizer( CultureInfo choosenCulture )
  {
    CustomCulture = choosenCulture;
  }
  public string GetLocalizedString(System.Globalization.CultureInfo culture, string name,object obj)
  {
    //Arabic language
    if (this.CustomCulture != null && this.CustomCulture.Name == "ar")
    {
      switch (name)
      {
        #region Menu Package
        case ToolsResourceIdentifiers.MoreButtonsItemsText:
             return "عرض المزيد من الأزرار";
        case ToolsResourceIdentifiers.FewerButtonsItemsText:
             return "إظهار أزرار أقل";
        case ResourceIdentifiers.GroupBarAddRemoveButton:
             return "إضافة أو إزالة الأزرار";
        #endregion
        default:
        return string.Empty;
      }
    }
    return string.Empty;
  }
  #endregion
}

 

Code Example: [VB]

 

'Codes in Form1.vb
LocalizationProvider.Provider = New Localizer()
'For Arabic Language
Dim Arabic As New CultureInfo("ar")
LocalizationProvider.Provider = New Localizer(Arabic)
 
Friend Class Localizer
Implements ILocalizationProvider
  Private CustomCulture As CultureInfo
  #Region "ILocalizationProvider Members"
  Public Sub New()
  End Sub
  Public Sub New(ByVal choosenCulture As CultureInfo)
    CustomCulture = choosenCulture
  End Sub
  Private Function ILocalizationProvider_GetLocalizedString(culture As CultureInfo, name As  String, ctrl As Object) As String Implements ILocalizationProvider.GetLocalizedString
    'Arabic language
    If Me.CustomCulture IsNot Nothing AndAlso Me.CustomCulture.Name = "ar" Then
      Select Case name
      '#Region "Menu Package"
      Case ToolsResourceIdentifiers.MoreButtonsItemsText
           Return "عرض المزيد من الأزرار"
      Case ToolsResourceIdentifiers.FewerButtonsItemsText
           Return "إظهار أزرار أقل"
      Case ResourceIdentifiers.GroupBarAddRemoveButton
           Return "إضافة أو إزالة الأزرار"
      '#End Region
      Case Else
           Return String.Empty
      End Select
    End If
   Return String.Empty
  End Function
 #End Region
End Class

 

Screenshot

 

Before localize the navigation pane button text

Figure: Before localization.

 

 

After localize the navigation pane button text
Figure: After localization 

 

Samples:

C#:  GroupBarExample

VB:  GroupBarExample

2X faster development

The ultimate WinForms 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
Live Chat Icon