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

Localization

Updated over 6 months ago

To localize RadTreeView to display control text and messages in a specific language:

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

  • Start by creating a descendant of the TreeViewLocalizationProvider 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:

Localizing RadTreeView Strings

C#
public class MyEnglishTreeViewLocalizationProvider : TreeViewLocalizationProvider
{
    public override string GetLocalizedString(string id)
    {
        switch (id)
        {
            case TreeViewStringId.ContextMenuCollapse:
                return "Collapse";
            case TreeViewStringId.ContextMenuDelete:
                return "Delete";
            case TreeViewStringId.ContextMenuEdit:
                return "Edit";
            case TreeViewStringId.ContextMenuExpand:
                return "Expand";
            case TreeViewStringId.ContextMenuNew:
                return "New";
            default:
                base.GetLocalizedString(id);
                break;
        }
        return "";
    }
}

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

Assigning the Current Localization Provider

C#
TreeViewLocalizationProvider.CurrentProvider = new MyEnglishTreeViewLocalizationProvider();

The code provided above illustrates the approach to be used to localize the RadTreeView and is not intended as a full translation.

See Also

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