|
About Translations
By storing most user interface words within a few files that contain only long lists of words, phrases, and sentences, it is possible and easy to translate Discus into a foreign language. This document explains how these language variables are imported into templates and can even be defined in templates.
As of version 4.0, the following three files contain translated words, phrases, and sentences:
language.conf: Basic user interface words and date formats, used in all available versions of freeware Discus and Discus Pro
language_pro.conf: Additional user interface words, used in Discus Pro 3.10 and 4.00
lang40.conf: Additional user interface words and date formats introduced in Discus and Discus Pro 4.00
Throughout this documentation, the three files above will be referred to collectively as the "language.conf" files.
Accessing data from language files
Most language.conf variables are simple text strings. These are accessed in the $L hash, and can be used in either of the following ways:
$L{DISCUS_PROGRAM_ERROR_MESSAGE}
$L->{ERROR_AUTHENTICATION_WRONG_USERNAME_AND_PW}
Some language.conf words are arrays (weekdays, months, etc.). You can extract the appropriate array element using the following syntax:
$L{MONTH}[0]
This output shows the result from the default (English) language.conf file.
January
"Backup" for undefined language.conf entries
If an entry is not defined from the language.conf file, the result in the user interface will be a blank line (a missing word from a sentence, a button with no text, an option with no text, etc.). This can occur most commonly when new language.conf versions are developed after translations have already been received.
The following command structure allows you to define a language variable. If the language variable is defined in language.conf, then your command to define the variable is ignored. Your command will be executed only if the language file is missing the variable you are defining. Your definition takes effect the first time it is executed and it affects all future templates during the operation.
<#language: $L{CHECK_NEW_MESSAGES} = "Check new messages"#>
Reiterating the above paragraph, the above example will first check the language file to see if the variable CHECK_NEW_MESSAGES has been defined. If it has, the command above does absolutely nothing. If CHECK_NEW_MESSAGES has not been defined, then $L{CHECK_NEW_MESSAGES} will be defined to "Check new messages" for all future operations within that template (as well as within any other templates that are rendered).
|