Viewer Localization Support

Localization is the process of customizing your application to a given culture and locale. Windows provides strong support for localization and DynamicPDF Viewer is no different. Adding localization to your DynamicPDF Viewer application is straightforward. When adding localization, you can pass the resource using a Window's resource manager or you can specify the resource to load directly using code within the DynamicPDF Viewer.

Resource Folder

Regardless of how you chose to localize your application, you must create the appropriate resource files specifying the languages desired. Each file contains the project's properties in the language specified. To create these files, create a folder named Resources in your project's solution explorer. Then, in this folder place the desired resource files.

NOTE: Resource files follow the following format: "ceTe.DynamicPDF.Viewer.Localization." where the file extension can be hi-IN, en-UK etc. for example: ceTe.DynamicPDF.Viewer.Localization.hi-IN is a valid filename for the language . See for a list of resource file extensions.

After creating the required resource files, assign the required culture information to the current thread where the form using the DynamicPdf Viewer control. For example, the following code can be added to the form constructor, as the following illustrates.

InitializeComponents(): 

System.Threading.Thread.CurrentThread.CurrentUICulture = new
    System.Globalization.CultureInfo("en-IN");

If the specified culture ("en-IN" in the above example) is present under the Resources folder, then it is loaded during the DynamicPdf Viewer control initialization.

Windows ResourceManager

You can also use the Windows ResourceManager. To use Microsoft's ResourceManager class (System.Resources.ResourceManager), build a windows forms application and create a resource manager instance. The resource manager instance, if it finds the specified resource file, loads the correct resource file and displays the control labels using the user's chosen language.

NOTE: Refer to the Microsoft article, Globalizing and localizing .NET applications, for more information on adding localization using a ResourceManager.

After creating a ResourceManager instance, you then create a new PDFViewer by passing the resource manager instance to the PDFViewer constructor, as the following code illustrates.

PdfViewer myViewer = new PdfViewer(resourcemanager);       
PdfViewer MyViewer = New PdfViewer(resourcemanager)

DynamicPDF Viewer Programmatically

An alternative to using a .NET ResourceManager class is to load a resource file at runtime. As before, first create a Windows forms application. Also create a folder name “Resources” under project in the solution explorer. In the newly created Resources folder, place the modified resource file. The file name should follow the format: “ceTe.DynamicPDF.Viewer.Localization.” where extension can be hi-IN, en-UK, or other valid language localization extension (e.g. ceTe.DynamicPDF.Viewer.Localization.hi-IN).

After adding the file, assign the required cultural information to the current form's thread where DynamicPDF Viewer control is used. For example, the following code can be added to the form constructor.

InitializeComponents(): 
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-IN");

5. If the specified culture ("en-IN" in the above example) is present under the Resources folder then it will be loaded during initialization of Viewer control.

6. If the specified culture is not present then the default user interface will be displayed.

7. If culture/language needs to be changed at run time, then you need to create a Viewer control after changing the CurrentUICulture of the thread

In this topic