Search Locate Previous Contents

Translating the Viewer Text

All the text elements associated with the NewLeaf viewer may be translated into your local language by maintaining a simple text phrasebook file and reading this into the application at initialisation, or simply before saving the workspace prior to shipping. Phrasebooks in most common European languages are shipped by Causeway, but if you wish to create your own file, the format is very simple, and you may start simply by renaming the uk-en.phb file and modifying the phrases as appropriate.

Using an existing phrasebook
This is managed with two service functions:

‘de„PostScrp.GetPhraseBook 'c:\deutsch.phb'

This reads the phrase table from file, and sets it as the active phrasebook for the viewer. You may ignore the result if you only run in a single language – just save the workspace with the phrase table in place. However if you regularly switch languages, you can keep the result in a variable (or on your own component file) and pass it as argument to:

PostScrp.UsePhraseBook ‘de

Note that this is the internal form of the phrase table, and may be changed in the future. It is always safest to maintain the plain text form as an external .PHB file.

Phrasebook file format
The format of the file is: {TAG=Phrase [# Purpose of phrase]} with one phrase per line. A special phrase is anything beginning ‘~’ which removes a tool button or menu item completely. You can force newlines in a phrase with the ASCII ‘pipe’ character (this only applies to error messages and tooltips). You may use tabs in place of the ‘=’ and ‘#’ delimiter characters if you prefer.

Lines beginning with blank, and comment lines (which begin with the ‘#’ character) are ignored; all trailing space is removed from the phrase. Please note that the short tags used to identify the phrase to the viewer are case-sensitive, and should not be altered.

Here is a small sample from the uk-en phrasebook file:

# Input request dialogues
WMFC=Metafile Copy                       # Copy dialogue title
WMFE=Invalid file name or directory ...  # Copy dialogue error
BMPS=Bitmap Scale                        # Bitmap scale title
GIFS=GIF Scale                           # GIF scale title

Where data is to be inserted into a phrase at run-time, the parameters are marked with the symbols %1 %2 and so on, for example Page %1 of %2.

When new capabilities are added to the viewer, local Causeway distributors, users or other volunteers will be contacted to update the necessary texts before the product is shipped. If a phrase cannot be translated in time, the phrasebook will be shipped with the new phrase in English. Missing phrases show in the viewer with the identifying tag only.



© Copyright Causeway Graphical Systems Ltd 2001