PrizmDoc Viewer v13.8 - Updated
Localizing the Viewer
Developer Guide > Viewer > Configure the Viewer > Configuration Options > Localizing the Viewer

The Viewer has a language localization feature which allows you to customize labels and text using a language JavaScript object. 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
}

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: