jPDFViewer Localization

ViewerLabels.properties can be found inside the jPDFViewer.jar file and contains the English labels for jPDFViewer.

Current Languages Supported

Qoppa PDF Component jPDFViewer supports 5 languages: English, German, Italian, French, Spanish. jPDFViewer uses the default locale as reported by java: Locale.getDefault() to determine what language to use.

In jPDFViewer.jar file are also packaged the files for the 4 additional languages supported:

  1. ViewerLabels_de.properties (German)
  2. ViewerLabels_es.properties (Spanish)
  3. ViewerLabels_fr.properties (French)
  4. ViewerLabels_it.properties (Italian).

Adding other languages

jPDFViewer can be customized to add other languages. The way to do so is to create a new file for each new language that contains the translations of jPDFViewer’s labels in this language.

The file name’s pattern for the new language needs to be:
ViewerLabels_LanguageCode.properties

where the language code is a valid ISO Language Code. These codes are the lower-case two-letter codes as defined by ISO-639. You can find a full list of these codes at a number of sites, such as:
http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

So for instance for Spanish, you will have to create a new file called (this is just an example, the spanish file is already there so no need to create it)

ViewerLabels_es.properties

If you’d like to further localize within a given language for a specific country,  you can also add a file for that specific country

ViewerLabels_LanguageCode_CountryCode.properties

so for instance for Spanish in Mexico, you would create a file called

ViewerLabels_es_mx.properties

where the country code is a valid ISO Country Code.

These codes are the upper-case two-letter codes as defined by ISO-3166. You can find a full list of these codes at a number of sites, such as:
http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html

Do all labels need to be localized?

The new localization files don’t need to contain all the labels but only the labels that need to be overwritten in this specific language / country. The other labels will be read by default from the previous file in the hierarchy.

Where to add the localization files

The localization files need to be somewhere in your application classpath either packaged in a jar file or saved in a directory which is included the classpath.

The localization files need to be located under a folder called “labels” to mirror the location of Qoppa localization files in the jPDFViewer.jar.  jPDFViewer will look under all classpath resources under the labels folder for localization file.

Where to start? Contact us!

We keep all our labels in an Excel Spreadsheet where each language is in a different column and we have hints about where labels can be found in the component. There is a macro that can output the different labels into separate properties files per language. Ask us for this spreadsheet if you need to translate to a different language.

What about jPDFNotes, jPDFEditor?

jPDFNotes needs ViewerLabels.properties and has an additional NotesLabels.properties file.

jPDFEditor needs ViewerLabels.properties, NotesLabels.properties and has an additional EditorLabels.properties files.

Non-Latin Languages (CJK, etc..)

Note that properties files are expected to be ISO-8859-1 files. For languages containing non-Latin characters such as Asian languages, the workaround is to create a file in utf8 encoding and convert it using the java utility called native2ascii which is located under the java bin directory (distributed with java 1.5). For instance to translate a UTF8 file called ViewerLabels_cz.utf8 with Chinese labels then make the following call:

native2ascii -encoding utf8 ViewerLabels_cz.utf8 ViewerLabels_cz.properties