GHS BULLETIN
Multiple-Language Support


GHSWORDSn.DAT files

A file named GHSWORDS.DAT establishes a set of keywords and their English-language equivalents. The format is simple: it consists of two columns, the first being keywords and the second being the English word or phrase associated with each keyword.

If a file named GHSWORDS1.DAT is found in the user's library folder, it will be consulted instead of GHSWORDS.DAT when LANGUAGE 1 is in effect.

Additional files GHSWORDS2.DAT, GHSWORDS3.DAT, etc. represent additional languages.

Only GHSWORDS.DAT is supplied with the program. The user is free to make the additional files representing translations in any language.

To create the first language file,

1. Make a copy of GHSWORDS.DAT (found in the program folder), placing it in the library folder, and name it GHSWORDS1.DAT.

2. Edit GHSWORDS1.DAT by adding a third column of words or phrases in the desired language (translating the second column). Keep the second column intact. Note that the second and third columns may contain words or phrases; therefore they must be enclosed in quotation marks. Commas or spaces may separate columns. Note that GHSWORDS.DAT is a Unicode file so that its derivative will support the extended character set used by some languages.

3. You may add new keywords. It is best to keep the lines in keyword-alphabetical order. Keywords may consist only of the letters A-Z, digits 0-9, and the underscore character; and they must begin with a letter (the same rules that apply to variable names). Keywords are not case sensitive. Do not add keywords to the original GHSWORDS.DAT file. The English definition in the second column of your file will be used if the keyword does not exist in the original file.

When GHSWORDS.DAT is updated by Creative Systems, you do not lose any of the keywords and translations in any GHSWORDSn.DAT files that you may have developed. If there are new entries in the new GHSWORDS.DAT file, you get those automatically in English without having to transfer them to your files.

Another feature of the GHSWORDS file is where a keyword represents several lines. For example,
INTRO1
-1 "This wizard is for the purpose of astounding you."
-2 "You will notice that whatever it does defies logic."
-3
-4 "For example, try the button called Panic."
-5 "Have no fear, it does nothing."
To insert these lines of text (without the leading numbers) in your template, you would use,
 
expand _.lines intro1

Words for Wizards

When a wizard is equipped to be multi-lingual, it makes its own GHSWORDS_name.DAT file. For example, when you run the latest version of INCLINE.WIZLI you will find that it has created GHSWORDS_INCLINE.DAT in your library folder. If you want to add a language to it, follow the same steps as above. For example, GHSWORDS_INCLINE1.DAT would represent the first added language.

If you want to add multi-lingual capability to your own wizard, the best instruction for doing that would be to view INCLINE.WIZLI and use it as an example. The wizard MAKEWORDS will scan your wizard file for words and phrases that are likely candidates for being multilingual and write them on a file in the form of a macro that you can edit and paste into your wizard file.

Making use of the keywords

The keywords are referenced as variables. For example, the keyword Displacement exists in GHSWORDS.DAT. The variable reference {_.Displacement} will return the value from the second column (which is Displacement). However, if LANGUAGE 1 is in effect, the value from the third column for that keyword in GHSWORDS1.DAT will be returned. If there is nothing in the third column for a particular keyword, the contents of the second column will be used. If the keyword is not found either in GHSWORDS.DAT or the current GHSWORDSn.DAT, then the keyword itself will be returned. Thus any variable reference starting with _. will never be undefined.

Example of keyword use in a template:

template LSW
"{_.LightShip} {_.Displacement} = {DISPL}"
/


Making existing templates multi-lingual is a straightforward procedure. It may require new entries in your GHSWORDSn.DAT file in order to support all the words and phrases in your templates.

Keyword variable references can appear in NOTE commands too. However, the text in note commands is limited to the smaller character sets.


The LANGUAGE command

LANGUAGE 1 switches to using GHSWORDS1.DAT.

LANGUAGE 0 switches back to English (using only GHSWORDS.DAT).

Before the keywords will return the expected results, the LANGUAGE command must have been issued. LANGUAGE without parameters ensures this without changing the language number if one has already been specified.

Once the LANGUAGE command has been issued, certain features of the Language module are available:

_._langlist is a special string variable that returns the dropdown list control for templates representing the available languages.

_._lang is a special numeric variable that holds the current language number.

_.dolang is a macro call that registers a change in language number.

Putting these together, the template line to implement the dropdown menu would be,

{_._langlist} _._lang /enter /apply:_.dolang /persist:refresh

Another use of the LANGUAGE command is to specify the .LNG file that translates error messages and a few of the words used in GHS reports. GHSWORDSn.DAT files can specify the .LNG file name also, so that switching languages by number automatically brings in the appropriate .LNG file. The keyword LanguageFile provides the file name. For example, here are the first few lines of a GHSWORDS1.DAT file for the French language:
  English French
  LanguageFile "FRENCH"
  EraseThisWiz "Effacer cet Assistant"
  Criterion "critère"
This calls for a file named FRENCH.LNG to be accessed for units names and optionally error-message translations. A minimal version of it would look like this:
METRIC TONS,"met tonnes",tonnes
LANGUAGE=1
Note that longer and a shorter equivalents for METRIC TONS is provided, which gives the program a shorter form to use when space is limited.

The LANGUAGE= line at the end indicates that GHSWORDS1.DAT is the corresponding words file. This provides for easier use of the LANGUAGE command since LANGUAGE FRENCH becomes equivalent to LANGUAGE 1.


Copyright (C) 2016 Creative Systems, Inc.