Language Files

Language files are used as a source of text data (string resource) for generation of notifications, output of text messages or insertion of text fragments into processed email messages. Language files are used mainly by Notifier, but they can also be used by the plug-ins (for example, Drweb plug-in uses text from a language file to replace a malicious attachment with the text). Path to the directory where the language files are located must be the same for Notifier and the plug-ins. Path to this directory is specified in value of the LngBaseDir parameter (see above).

Pattern of a language file name is as follows [<plug-in>_]<language>.lng, where:

<plug-in> – name of the plug-in that uses this file as a string source (drweb, modifier and others)

<language> – name of the language used in the file.

Language files used by Notifier do not have the <plug-in>_ prefix in their names.

Language file has the following structure:

In the first line, short name of the used language is given (for example, en, ru).

In the second line, name of the used encoding is given (for example, koi8-r).

In the third line, number of bits in CTE is given (7bit or 8bit).

Other lines contain strings of the N="text" type, where N – number (identifier) of the string, and text – the used text.

Also a language file can contain empty strings and comments (starting from # symbol). These strings are ignored.

Please note that only short names of languages (from the first line of a language file) can be used as a value of the NotifyLangs parameter (see above).

Example of a language file:

#language name = LANG
en
#coding system = CHARSET
UTF8
#Content-Transfer-Encoding: 7bit/8bit
8bit
 
1 = "OK"
2 = "password protected, skipped"
...

All plug-ins use only the language file specified first in the NotifyLangs list for Notifier. For searching the necessary string (upon handling of $n macro specified, for example, for add-header action), the plug-in always uses the following algorithm:

1)Directory with language files is determined (value of the LngBaseDir parameter from the [Notifier] section is always used);

2)Used language is determined according to the first value in the NotifyLangs list  from the [Notifier] section;

3)Required language file is searched by the following criteria: its name contains prefix with the plug-in name and its first line contains necessary short language name;

4)If the file is found, the string with required n number is searched. It is assumed that text in the string is encoded with the CTE and encoding that are specified in the file header.

The found string will be used for message processing (added either to the header or message body, depending on plug-in action). Encoding and CTE are specified in the language file header.

If either the required language file or string in the file cannot be found, an error occurs. This error is handled according to the ProcessingError parameter value.

If necessary, you can add some strings in the language files. At that, added strings must satisfy the following criteria:

avoid already occupied numbers, because these strings are used by Dr.Web MailD modules (or a plug-in);

use the encoding and CTE specified in file header.