Localization

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

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

  • Start by creating a descendant of the ChatLocalizationProvider 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 of 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 RadChat Strings

public class MyEnglishChatLocalizationProvider : Telerik.WinControls.Localization.ChatLocalizationProvider
{
    public override string GetLocalizedString(string id)
    {
        switch (id)
        {
            case ChatStringId.TypeAMessage: return "Type a message";
            case ChatStringId.OverlayOK: return "OK";
            case ChatStringId.OverlayCancel: return "Cancel";
            case ChatStringId.FlightCardDeparture: return "Departure";
            case ChatStringId.FlightCardArrival: return "Arrival";
            case ChatStringId.FlightCardPassenger: return "Passenger";
            case ChatStringId.FlightCardTotal: return "Total";
            default:
                break;
        }
        return base.GetLocalizedString(id);
    }
}

Public Class MyEnglishChatLocalizationProvider
    Inherits Telerik.WinControls.Localization.ChatLocalizationProvider
    Public Overrides Function GetLocalizedString(ByVal id As String) As String
        Select Case id
            Case ChatStringId.TypeAMessage
                Return "Type a message"
            Case ChatStringId.OverlayOK
                Return "OK"
            Case ChatStringId.OverlayCancel
                Return "Cancel"
            Case ChatStringId.FlightCardDeparture
                Return "Departure"
            Case ChatStringId.FlightCardArrival
                Return "Arrival"
            Case ChatStringId.FlightCardPassenger
                Return "Passenger"
            Case ChatStringId.FlightCardTotal
                Return "Total"
            Case Else
        End Select
        Return MyBase.GetLocalizedString(id)
    End Function
End Class

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

Assigning the Current Localization Provider

ChatLocalizationProvider.CurrentProvider = new MyEnglishChatLocalizationProvider();

ChatLocalizationProvider.CurrentProvider = New MyEnglishChatLocalizationProvider()

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

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