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

Localization

To localize RadFilterView 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 RadFilterViewLocalizationProvider 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 RadFilterView Strings

public class EnglishFilterViewLocalizationProvider : Telerik.WinControls.UI.FilterView.RadFilterViewLocalizationProvider
{
    public override string GetLocalizedString(string id)
    {
        switch (id)
        {
            case RadFilterViewStringId.ClearCategoryFilterMenuItem: return "Clear Filter";
            case RadFilterViewStringId.ClearAllFiltersMenuItem: return "Clear All Filters";
            case RadFilterViewStringId.BooleanCategoryTrue: return "True";
            case RadFilterViewStringId.BooleanCategoryFalse: return "False";
            case RadFilterViewStringId.NumericCategoryFrom: return "From:";
            case RadFilterViewStringId.NumericCategoryTo: return "To:";
            default: return base.GetLocalizedString(id);
        }
    }
}

Public Class EnglishFilterViewLocalizationProvider
    Inherits Telerik.WinControls.UI.FilterView.RadFilterViewLocalizationProvider
    Public Overrides Function GetLocalizedString(ByVal id As String) As String
        Select Case id
            Case RadFilterViewStringId.ClearCategoryFilterMenuItem
                Return "Clear Filter"
            Case RadFilterViewStringId.ClearAllFiltersMenuItem
                Return "Clear All Filters"
            Case RadFilterViewStringId.BooleanCategoryTrue
                Return "True"
            Case RadFilterViewStringId.BooleanCategoryFalse
                Return "False"
            Case RadFilterViewStringId.NumericCategoryFrom
                Return "From:"
            Case RadFilterViewStringId.NumericCategoryTo
                Return "To:"
            Case Else
                Return MyBase.GetLocalizedString(id)
        End Select
    End Function
End Class

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

Assigning the Current Localization Provider

RadFilterViewLocalizationProvider.CurrentProvider = new EnglishFilterViewLocalizationProvider();
InitializeComponent();

RadFilterViewLocalizationProvider.CurrentProvider = New EnglishFilterViewLocalizationProvider()
InitializeComponent()

See Also

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