PrizmDoc v13.2 - Updated
Localizing the Viewer
Administrator Guide > System Configuration > Configure the Viewer > Configuration Options > Localizing the Viewer

The Viewer has a language localization feature which allows you to customize labels and text using the language.json file. The language.json file is included in all the sample projects. The language object is passed as a parameter in the Viewer plugin configuration options:

Example
Copy Code
var pluginOptions = {
    documentID: viewingSessionId,
    language: languageItems,
    template: htmlTemplates
}

Editing language.json

The language.json file is in JSON(http://json.org/) format. Pay close attention to formatting to ensure that there are no syntax errors. You may want to validate the file using a JSON validator like http://jsonlint.com/.

Using the Language Parameters

In viewer.js the language parameters are used in various places. Here a message is being shown with the printRangeError language parameter:

Example
Copy Code
viewer.notify({message: viewer.language.printRangeError});

 

When the HTML templates are loaded, using the Underscore.js Template utility function, the language object is used as template data:

Example
Copy Code
element.html(_.template(options.template.viewer, options.language))

 

The language parameters are then referenced as variables in the templates:

Example
Copy Code
<!-- This is using the "rotate" parameter from language.json -->
<button data-pcc-rotate class="pcc-icon pcc-icon-rotate"
     title="<%= rotate %>"></button>
For more information on template syntax see the Underscore.js Template documentation at http://underscorejs.org/#template.

Common Pitfalls

When editing the language.json file or the templates there may be some errors for which the cause may not be immediately obvious. Here are some common console errors and their possible causes: