New to Telerik UI for WinForms? Download free 30-day trial

Localization

All required classes for localization are defined in the Telerik.WinControls.UI.Localization namespace. To localize RadMap to display text in a specific language:

  • Start by creating a descendant of the RadMapLocalizationProvider class.

  • Override the GetLocalizedString(string id) method and provide a translation for the label. 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.

Below is a sample implementation of an English localization provider:

Localizing RadMap's Strings


public class EnglishMapLocalizationProvider : Telerik.WinControls.UI.Localization.RadMapLocalizationProvider
{
    public override string GetLocalizedString(string id)
    {
        switch (id)
        {
            case RadMapStringId.SearchBarNullText:
                return "Search";
            case RadMapStringId.ScaleIndicatorMiles:
                return "mi";
            case RadMapStringId.ScaleIndicatorKilometers:
                return "km";
            case RadMapStringId.ScaleIndicatorFeet:
                return "ft";
            case RadMapStringId.ScaleIndicatorMeters:
                return "m";
            case RadMapStringId.BingMapsAerialView:
                return "Aerial";
            case RadMapStringId.BingMapsRoadView:
                return "Road";
            case RadMapStringId.NavigationBarShowViewLabels:
                return "Show labels";
        }

        return string.Empty;
    }
}

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

Assigning the Current Localization Provider


public MapLocalization()
{
    Telerik.WinControls.UI.Localization.RadMapLocalizationProvider.CurrentProvider = new EnglishMapLocalizationProvider();
    InitializeComponent();
}
In this article