Language Translation

Introduction

Some components of DMail, including DList, DPOP and DSMTP, feature language translation. This is quite simple in operation; phrases which these products generate can be replaced by user specified phrases. This behaviour is specified in language files.


Contents

  1. What Is A Language File?
  2. How Does Translation Work?
  3. How Do I Get A Language File?
  4. How Do I Modify A Language File?
  5. How Do I Use Language Translation With DLIST?
  6. How Do I Use Language Translation With DPOP?


What Is A Language File?

A language file consists of pairs of phrases, and comments prefixed by '#'. For example:

# This is a sample language file

%s has %d post office messages
%s hat %d Postmeldungen
%s password wrong or not a valid user
%s Passwort falsch oder kein gültiger Benutzer


How Does Translation Work?

If given a phrase to translate (say, %s has %d post office messages), the product will search through the pairs until it finds the line containing the phrase. It will then use the next line as the translation (in this case, %s hat %d Postmeldungen). Language files are cached to prevent frequent disk access. Only 10 language files remain in the cache at any one time. For this reason, we recommend that no more than 10 language files be used for each product (i.e. 10 for DList, 10 for DPOP, and 10 for DSMTP).



How Do I Get A Language File?

All DMail components that feature language translation are supplied with default language files. See your DMail directory (e.g. \dmail or /usr/bin/dmail). These contain a list of all translatable phrases and translated phrases, in the following format:

%s has %d post office messages
Translation of: %s has %d post office messages
%s password wrong or not a valid user
Translation of: %s password wrong or not a valid user


How Do I Modify A Language File?

All language files are in ASCII text, and can be modified with any good text editor. All you need to do is change the translations from the default values into the values which you choose. It is generally best to follow this procedure in order:

Original File
%s has %d post office messages
Translation of: %s has %d post office messages
%s password wrong or not a valid user
Translation of: %s password wrong or not a valid user
Instruction   File After Modification
 

Translate all translation lines you wish the product to use.

 
%s has %d post office messages
Translation of: %s hat %d Postmeldungen
%s password wrong or not a valid user
Translation of: %s password wrong or not a valid user

Remove the old 'Translation of:' phrases.

 
%s has %d post office messages
%s hat %d Postmeldungen
%s password wrong or not a valid user
Translation of: %s password wrong or not a valid user

Comment out any translations you do not want the product to perform.

 
%s has %d post office messages
%s hat %d Postmeldungen
# %s password wrong or not a valid user
# Translation of: %s password wrong or not a valid user

NOTE CAREFULLY:

  1. Never remove any variables (e.g. %s, %d) from a translation, nor change the order in which they appear. This would cause incorrect display of messages, and instability of the product.

  2. A language file need not specify all phrases generated by the product. If you don't wish a certain phrase to be translated, simply comment it out or delete it.

  3. Never change the original phrase line of any pair, only the translation line. For example, in the default language file, you would only change lines like:

    Translation of: %s has %d post office messages


How Do I Use Language Translation With DLIST?

When creating your lists.dat file, simply add a language_file setting to each list you want translated. This setting specifies the location of the language file to use for that list. For example:

list newproducts
  title Discussion of new products
  language_file german.dat

For further information on this setting, see http://www.netwinsite.com/dmail/dlist.htm.



How Do I Use Language Translation With DPOP?

You need to add a language_file_dpop setting to dmail.conf. This specifies the language file that DPOP will use. For example:

language_file_dpop german.dat

For further information on this setting, see http://www.netwinsite.com/dmail/dp_set.htm.