Localization

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

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

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

public class MyRadMaskedEditBoxLocalizationProvider : RadMaskedEditBoxLocalizationProvider
{
    public override string GetLocalizedString(string id)
    {
        switch (id)
        {
            case RadMaskedEditBoxStringId.CopyMenuItem: return "Copy";
            case RadMaskedEditBoxStringId.CutMenuItem: return "Cut";
            case RadMaskedEditBoxStringId.DeleteMenuItem: return "Delete";
            case RadMaskedEditBoxStringId.PasteMenuItem: return "Paste";
            case RadMaskedEditBoxStringId.SelectAllMenuItem: return "SelectAll";
        }
        return string.Empty;
    }
}

Public Class MyRadMaskedEditBoxLocalizationProvider
    Inherits RadMaskedEditBoxLocalizationProvider
    Public Overrides Function GetLocalizedString(ByVal id As String) As String
        Select Case id
            Case RadMaskedEditBoxStringId.CopyMenuItem
                Return "Copy"
            Case RadMaskedEditBoxStringId.CutMenuItem
                Return "Cut"
            Case RadMaskedEditBoxStringId.DeleteMenuItem
                Return "Delete"
            Case RadMaskedEditBoxStringId.PasteMenuItem
                Return "Paste"
            Case RadMaskedEditBoxStringId.SelectAllMenuItem
                Return "SelectAll"
        End Select
        Return String.Empty
    End Function
End Class

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

Assigning the Current Localization Provider

RadMaskedEditBoxLocalizationProvider.CurrentProvider = new MyRadMaskedEditBoxLocalizationProvider();

In this article
Not finding the help you need? Improve this article