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

Localization

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

  1. Start by creating a descendant of the GanttViewLocalizationProvider class.

  2. Override the GetLocalizedString(string id) method and provide a translation for the texts. 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 MyEnglishGanttViewLocalizationProvider : GanttViewLocalizationProvider
{
    public override string GetLocalizedString(string id)
    {
        switch (id)
        {
            case GanttViewStringId.ContextMenuAdd:
                return "&Add";
            case GanttViewStringId.ContextMenuAddChild:
                return "Add &Child";
            case GanttViewStringId.ContextMenuAddSibling:
                return "Add &Sibling";
            case GanttViewStringId.ContextMenuDelete:
                return "&Delete";
            case GanttViewStringId.ContextMenuProgress:
                return "&Progress";
            case "TimelineWeek":
                return "Week";
        }
        return string.Empty;
    }
}

Public Class MyEnglishGanttViewLocalizationProvider
    Inherits GanttViewLocalizationProvider
    Public Overrides Function GetLocalizedString(id As String) As String
        Select Case id
            Case GanttViewStringId.ContextMenuAdd
                Return "&Add"
            Case GanttViewStringId.ContextMenuAddChild
                Return "Add &Child"
            Case GanttViewStringId.ContextMenuAddSibling
                Return "Add &Sibling"
            Case GanttViewStringId.ContextMenuDelete
                Return "&Delete"
            Case GanttViewStringId.ContextMenuProgress
                Return "&Progress"
            Case "TimelineWeek"
                Return "Week"
        End Select
        Return String.Empty
    End Function
End Class

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

GanttViewLocalizationProvider.CurrentProvider = new MyEnglishGanttViewLocalizationProvider();

GanttViewLocalizationProvider.CurrentProvider = New MyEnglishGanttViewLocalizationProvider()

In this article