Edit this page

Localization

To localize RadPdfViewer to display any text and messages in a specific language:

  • Create a custom PdfViewerLocalizationProvider 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:

RadPdfViewer Localization

public class MyLocalizationProvider : PdfViewerLocalizationProvider
{
    public override string GetLocalizedString(string id)
    {
        switch (id)
        {
            case PdfViewerStringId.ContextMenuCopy:
                return "&Copy";
            case PdfViewerStringId.ContextMenuSelectAll:
                return "Select &All";
            case PdfViewerStringId.ContextMenuDeselectAll:
                return "&Deselect All";
            case PdfViewerStringId.ContextMenuHand:
                return "&Hand";
            case PdfViewerStringId.ContextMenuSelection:
                return "&Selection";
            case PdfViewerStringId.ContextMenuPreviousPage:
                return "&Previous Page";
            case PdfViewerStringId.ContextMenuNextPage:
                return "&Next Page";
            case PdfViewerStringId.ContextMenuPrint:
                return "P&rint...";
            case PdfViewerStringId.ContextMenuFind:
                return "&Find Next";
            case PdfViewerStringId.NavigatorOpenButton:
                return "Open";
            case PdfViewerStringId.NavigatorPrintButton:
                return "Print";
            case PdfViewerStringId.RotateCounterclockwiseButton:
                return "Rotate Counterclockwise";
            case PdfViewerStringId.RotateClockwiseButton:
                return "Rotate Clockwise";
            case PdfViewerStringId.NavigatorPreviousPageButton:
                return "Previous page";
            case PdfViewerStringId.NavigatorNextPageButton:
                return "Next page";
            case PdfViewerStringId.NavigatorCurrentPageTextBox:
                return "Current page";
            case PdfViewerStringId.NavigatorTotalPagesLabel:
                return "Total pages";
            case PdfViewerStringId.NavigatorZoomInButton:
                return "Zoom in";
            case PdfViewerStringId.NavigatorZoomOutButton:
                return "Zoom out";
            case PdfViewerStringId.NavigatorZoomDropDown:
                return "Zoom drop-down";
            case PdfViewerStringId.NavigatorHandToolButton:
                return "Pan";
            case PdfViewerStringId.NavigatorSelectToolButton:
                return "Selection";
            case PdfViewerStringId.NavigatorFindNextButton:
                return "Find next";
            case PdfViewerStringId.NavigatorFindPreviousButton:
                return "Find previous";
            case PdfViewerStringId.NavigatorSearchTextBox:
                return "Search";
            case PdfViewerStringId.NavigatorNoResultMessage:
                return "No results found according to the specified criteria.";
            case PdfViewerStringId.NavigatorNoResultMessageHeader:
                return "Information";
            case PdfViewerStringId.NavigatorDefaultStrip:
                return "Default strip";
            case PdfViewerStringId.PrintPreviewGroupBoxPreview:
                return "Preview";
            case PdfViewerStringId.PrintPreviewGroupBoxOrientation:
                return "Orientation";
            case PdfViewerStringId.PrintPreviewGroupBoxSettings:
                return "Settings";
            case PdfViewerStringId.PrintPreviewButtonPrint:
                return "Print";
            case PdfViewerStringId.PrintPreviewButtonCancel:
                return "Cancel";
            case PdfViewerStringId.PrintPreviewButtonWatermark:
                return "Watermark";
            case PdfViewerStringId.PrintPreviewButtonSettings:
                return "Print Settings";
            case PdfViewerStringId.PrintPreviewLabelPageSizeInches:
                return "{0:F2} x {1:F2} Inches";
            case PdfViewerStringId.PrintPreviewLabelPageSizeCm:
                return "{0:F2}cm x {1:F2}cm";
            case PdfViewerStringId.PrintPreviewLabelScale:
                return "Scale: {0}%";
            case PdfViewerStringId.PrintPreviewLabelCurrentPage:
                return "Page {0} of {1}";
            case PdfViewerStringId.PrintPreviewFormTitle:
                return "Print Preview";
            case PdfViewerStringId.PrintPreviewPrintError:
                return "Error printing the document!";
            case PdfViewerStringId.PrintPreviewRadioPortrait:
                return "Portrait";
            case PdfViewerStringId.PrintPreviewRadioLandscape:
                return "Landscape";
            case PdfViewerStringId.PrintPreviewRadioAuto:
                return "Auto";
            case PdfViewerStringId.NavigatorFitToWidthButton:
                return "Fit To Width";
            case PdfViewerStringId.NavigatorFitToPageButton:
                return "Fit Full Page";
            case PdfViewerStringId.PageThumbnailsLabel:
                return "Page Thumbnails";
            case PdfViewerStringId.SaveButton:
                return "Save As";
        }
        return base.GetLocalizedString(id);
    }
}

Public Class MyLocalizationProvider
    Inherits PdfViewerLocalizationProvider
    Public Overrides Function GetLocalizedString(ByVal id As String) As String
        Select Case id
            Case PdfViewerStringId.ContextMenuCopy
                Return "&Copy"
            Case PdfViewerStringId.ContextMenuSelectAll
                Return "Select &All"
            Case PdfViewerStringId.ContextMenuDeselectAll
                Return "&Deselect All"
            Case PdfViewerStringId.ContextMenuHand
                Return "&Hand"
            Case PdfViewerStringId.ContextMenuSelection
                Return "&Selection"
            Case PdfViewerStringId.ContextMenuPreviousPage
                Return "&Previous Page"
            Case PdfViewerStringId.ContextMenuNextPage
                Return "&Next Page"
            Case PdfViewerStringId.ContextMenuPrint
                Return "P&rint..."
            Case PdfViewerStringId.ContextMenuFind
                Return "&Find Next"
            Case PdfViewerStringId.NavigatorOpenButton
                Return "Open"
            Case PdfViewerStringId.NavigatorPrintButton
                Return "Print"
            Case PdfViewerStringId.RotateCounterclockwiseButton
                Return "Rotate Counterclockwise"
            Case PdfViewerStringId.RotateClockwiseButton
                Return "Rotate Clockwise"
            Case PdfViewerStringId.NavigatorPreviousPageButton
                Return "Previous page"
            Case PdfViewerStringId.NavigatorNextPageButton
                Return "Next page"
            Case PdfViewerStringId.NavigatorCurrentPageTextBox
                Return "Current page"
            Case PdfViewerStringId.NavigatorTotalPagesLabel
                Return "Total pages"
            Case PdfViewerStringId.NavigatorZoomInButton
                Return "Zoom in"
            Case PdfViewerStringId.NavigatorZoomOutButton
                Return "Zoom out"
            Case PdfViewerStringId.NavigatorZoomDropDown
                Return "Zoom drop-down"
            Case PdfViewerStringId.NavigatorHandToolButton
                Return "Pan"
            Case PdfViewerStringId.NavigatorSelectToolButton
                Return "Selection"
            Case PdfViewerStringId.NavigatorFindNextButton
                Return "Find next"
            Case PdfViewerStringId.NavigatorFindPreviousButton
                Return "Find previous"
            Case PdfViewerStringId.NavigatorSearchTextBox
                Return "Search"
            Case PdfViewerStringId.NavigatorNoResultMessage
                Return "No results found according to the specified criteria."
            Case PdfViewerStringId.NavigatorNoResultMessageHeader
                Return "Information"
            Case PdfViewerStringId.NavigatorDefaultStrip
                Return "Default strip"
            Case PdfViewerStringId.PrintPreviewGroupBoxPreview
                Return "Preview"
            Case PdfViewerStringId.PrintPreviewGroupBoxOrientation
                Return "Orientation"
            Case PdfViewerStringId.PrintPreviewGroupBoxSettings
                Return "Settings"
            Case PdfViewerStringId.PrintPreviewButtonPrint
                Return "Print"
            Case PdfViewerStringId.PrintPreviewButtonCancel
                Return "Cancel"
            Case PdfViewerStringId.PrintPreviewButtonWatermark
                Return "Watermark"
            Case PdfViewerStringId.PrintPreviewButtonSettings
                Return "Print Settings"
            Case PdfViewerStringId.PrintPreviewLabelPageSizeInches
                Return "{0:F2} x {1:F2} Inches"
            Case PdfViewerStringId.PrintPreviewLabelPageSizeCm
                Return "{0:F2}cm x {1:F2}cm"
            Case PdfViewerStringId.PrintPreviewLabelScale
                Return "Scale: {0}%"
            Case PdfViewerStringId.PrintPreviewLabelCurrentPage
                Return "Page {0} of {1}"
            Case PdfViewerStringId.PrintPreviewFormTitle
                Return "Print Preview"
            Case PdfViewerStringId.PrintPreviewPrintError
                Return "Error printing the document!"
            Case PdfViewerStringId.PrintPreviewRadioPortrait
                Return "Portrait"
            Case PdfViewerStringId.PrintPreviewRadioLandscape
                Return "Landscape"
            Case PdfViewerStringId.PrintPreviewRadioAuto
                Return "Auto"
            Case PdfViewerStringId.NavigatorFitToWidthButton
                Return "Fit To Width"
            Case PdfViewerStringId.NavigatorFitToPageButton
                Return "Fit Full Page"
            Case PdfViewerStringId.PageThumbnailsLabel
                Return "Page Thumbnails"
            Case PdfViewerStringId.SaveButton
                Return "Save As"
        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:

Changing the Localization Provider

PdfViewerLocalizationProvider.CurrentProvider = new MyLocalizationProvider();

PdfViewerLocalizationProvider.CurrentProvider = New MyLocalizationProvider()

See Also