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

Localization

To localize RadPictureBox to display control 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 RadPictureBoxLocalizationProvider 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:

public class EnglishPictureBoxLocalizationProvider : RadPictureBoxLocalizationProvider
{

    public override string GetLocalizedString(string id)
    {
        switch (id)
        {
            case RadPictureBoxStringId.NoPictureText: return "No image";
            case RadPictureBoxStringId.CutMenuItem: return "Cut";
            case RadPictureBoxStringId.CopyMenuItem: return "Copy";
            case RadPictureBoxStringId.PasteMenuItem: return "Paste";
            case RadPictureBoxStringId.OpenMenuItem: return "Open";
            case RadPictureBoxStringId.SaveMenuItem: return "Save";
            case RadPictureBoxStringId.RemoveMenuItem: return "Remove";
            case RadPictureBoxStringId.EditMenuItem: return "Edit image";
            case RadPictureBoxStringId.DefaultImageSaveName: return "Image";
            case RadPictureBoxStringId.ErrorLoadingImageCaption: return "Error loading image";
            case RadPictureBoxStringId.ErrorLoadingImageText: return "Could not load the image.";
            case RadPictureBoxStringId.ErrorSavingImageCaption: return "Error saving image";
            case RadPictureBoxStringId.ErrorSavingImageText: return "Could not save the image.";
            case RadPictureBoxStringId.ImageEditorDialogHeader: return "Image Editor Dialog";
            case RadPictureBoxStringId.ImageEditorDialogOkButton: return "OK";
            case RadPictureBoxStringId.ImageEditorDialogCancelButton: return "Cancel";
            case RadPictureBoxStringId.EditSvgDialogImageCaption: return "Warning - Cannot edit SVG";
            case RadPictureBoxStringId.EditSvgDialogImageText: return "RadPictureBox cannot edit SVG images.\r\nWould you like to convert the SVG to a raster image and start editing?";

            default: return string.Empty;
        }
    }
}

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

Assigning the Current Localization Provider

RadPictureBoxLocalizationProvider.CurrentProvider = new EnglishPictureBoxLocalizationProvider();
In this article