New to Telerik UI for WinFormsStart a free 30-day trial

Localization

Updated over 6 months ago

To localize RadPropertyGrid to display control text and messages in a specific language, please consider the following:

  • All required classes for localization are defined in Telerik.WinConrtols.UI.Localization namespace.

  • Start by creating a descendant of the PropertyGridLocalizationProvider class.

  • Override the GetLocalizedString(string id) method and provide a translation for the label and user messages. If a translation is not provided, the default value will be returned. This behavior is guaranteed by the call to the base GetLocalizedString method in the default clause of the switch statement in the example.

Below is a sample implementation of an English localization provider:

Creating English Localization Provider

C#
public class MyEnglishPropertyGridLocalizationProvider : PropertyGridLocalizationProvider
{
    public override string GetLocalizedString(string id)
    {
        switch (id)
        {
            case PropertyGridStringId.ContextMenuReset: return "Reset";
            case PropertyGridStringId.ContextMenuEdit: return "Edit";
            case PropertyGridStringId.ContextMenuExpand: return "Expand";
            case PropertyGridStringId.ContextMenuCollapse: return "Collapse";
            case PropertyGridStringId.ContextMenuShowDescription: return "Show description";
            case PropertyGridStringId.ContextMenuShowToolbar: return "Show toolbar";
            case PropertyGridStringId.ContextMenuSort: return "Sorta";
            case PropertyGridStringId.ContextMenuNoSort: return "No Sort";
            case PropertyGridStringId.ContextMenuAlphabetical: return "Alphabetical";
            case PropertyGridStringId.ContextMenuCategorized: return "Categorized";
            case PropertyGridStringId.ContextMenuCategorizedAlphabetical: return "Categorized Alphabetical";
        }
        return base.GetLocalizedString(id);
    }
}

To apply the custom localization provider, instantiate and assign it to the current localization provider:

Changing the localization provider

C#
PropertyGridLocalizationProvider.CurrentProvider = new MyEnglishPropertyGridLocalizationProvider();

See Also

In this article
See Also
Not finding the help you need?
Contact Support