Localization in Windows Forms PDF Viewer (PdfViewerControl)

Localization is the process of configuring the application to a specific language. PDF Viewer provides support to localize all the static text used for tooltip and context menu contents. Localization can be done by adding resource file (Resx) in the application.
The following table shows the default values for the common text used in the PdfViewerControl which is in en-US culture:

Name Value
Bookmarks Bookmarks
Cancel Cancel
CloseBookmarks Click to close the bookmark pane
CloseSearchBar Close search bar
CopyException Copy exception detail to the clipboard
DocumentProtected This document is password protected. Please enter a Document Open Password.
EnterPassword Enter Password:
ErrorDocument Essential PDF Viewer could not open the PDF document
EssentialPdfViewer Essential Pdf Viewer
FitPage Click to show one page at a time.
FitWidth Click to fill the window with each page and scroll through pages continuously.
GoToFirstPage Click to go to first page in the document.
GoToLastPage Click to go to last page in the document.
GoToNextPage Click to go to next page in the document.
GoToPreviousPage Click to go to previous page in the document.
LoadingPage Loading Page
LoadingSeparator Of
Next Next
NoMatches Reader has finished searching the document. No more matches were found
Ok Ok
OpenDocument Click to open a PDF Document
Password Password
Previous Previous
PrintDocument Click to Print this PDF file or pages from it.
SaveDocument Click to save the document in the local disk
Searching Searching
Separator Of
ViewBookmarks Click to view the bookmarks
Zoom Zoom.
ZoomIn Click to increase the magnification of the entire page.
ZoomOut Click to decrease the magnification of the entire page.

Adding Resource file

  • Create a folder with name Resources in your application.
  • Add default English (“en-US”) Resx (resource) file of PdfViewerControl in the Resources folder named as Syncfusion.PdfViewer.Windows.resx.
  • Create Resx (resource) file and named as Syncfusion.PdfViewer.Windows.[Culture name].resx.For example, Syncfusion.PdfViewer.Windows.fr.resx for French culture.
  • Add the resource key such as OpenDocument and its corresponding localized value in Syncfusion.PdfViewer.Windows.fr.resx file. Refer the below screenshot for the same.
  • Execute the application in the French culture to see the changes.

Resource file

The following screenshot shows the PdfViewerControl in French language

Localization

Localize Resource File with Different Assembly or Namespace

In general, PdfViewerControl try to read the resource file from executing assembly and its default namespace by using Assembly.GetExecuteAssembly method. When the resource file is located at different assembly or namespace, then it can be set to the PdfViewerControl by using LocalizationManager.SetResources method.

public Form1()
{
	Thread.CurrentThread.CurrentCulture = newSystem.Globalization.CultureInfo("ar-AE");
	Thread.CurrentThread.CurrentUICulture = newSystem.Globalization.CultureInfo("ar-AE");

	// Set the Custom assembly and namespace for the localization.
	LocalizationManager.SetResources(typeof(Custom_Form).Assembly, "ClassLibrary");
	InitializeComponent();
}