Thursday 7 April 2011

RadWizard Localization

The new RadWizard from Telerik for WinForms is a great way of splitting up complex tasks into smaller chunks. If you wish to localize the RadWizard into another language it should be possible to give it a RadLocalizationProvider, just like you can with many of the other RadControls. However, this is not yet in the documentation so as this has just been brought up on the WinForms forums, I thought I would add a quick post to describe localization of the RadWizard.

First, create your own localization provider for RadWizard.

public class CustomRadWizardLocalizationProvider : RadWizardLocalizationProvider
{
    public override string GetLocalizedString(string id)
    {
        switch (id)
        {
            case RadWizardStringId.BackButtonText: return "<   L_Back";
            case RadWizardStringId.NextButtonText: return "L_Next   >";
            case RadWizardStringId.CancelButtonText: return "L_Cancel";
            case RadWizardStringId.FinishButtonText: return "L_Finish";
            case RadWizardStringId.HelpButtonText: return "<html><u>L_Help</u></html>";
            default: return string.Empty;
        }
    }
}

and then simply set the current provider as shown
public Form1()
{
    RadWizardLocalizationProvider.CurrentProvider = new CustomRadWizardLocalizationProvider();
    InitializeComponent();
}

1 comment:

  1. Did not work on visual basic:

    An error occurred creating the form. See Exception.InnerException for details. The error is: Root element is missing.

    Any clue?

    ReplyDelete