Views: 13313
Last Modified: 04.10.2024
Language is an account in the database that is available for editing in the administrative menu on the page
Control Panel > Settings > System settings > Language Parameters with the following main fields:
- identifier;
- name;
- date format;
- time format;
- encoding.
Both in the public and in the administrative parts the language is used first of all in order to select a specific language file.
Language determines the time and date format and page encoding in the administrative part. In the public part, these parameters are determined by the site settings.
Language Files
Language file is a PHP script storing translations of language phrases to a specific language.
This script contains $MESS arrays containing language phrase identifiers with values that are translations to a relevant language.
An example of a language file for the German language:
<?
$MESS ['SUP_SAVE'] = "Speichern";
$MESS ['SUP_APPLY'] = "Anwenden";
$MESS ['SUP_RESET'] = "Zurücksetzen";
$MESS ['SUP_EDIT'] = "Bearbeiten";
$MESS ['SUP_DELETE'] = "Löschen";
?>
An example of a language file for the English language:
<?
$MESS ['SUP_SAVE'] = "Save";
$MESS ['SUP_APPLY'] = "Apply";
$MESS ['SUP_RESET'] = "Reset";
$MESS ['SUP_EDIT'] = "Change";
$MESS ['SUP_DELETE'] = "Delete";
?>
Each language has its own set of language files stored in subcatalogs /lang/
of the system or module file structure.
As a rule, language files are used in the administrative scripts of modules or in components and are connected accordingly using one of the following functions:
For the sake of search convenience and the further modification of language phrases, the page parameter show_lang_files=Y may be used, which allows to quickly find and correct any language phrase using the module of Localization.
Examples
All dictionary arrays can be viewed using a simple command:
<? echo'';print_r($MESS);echo'
'; ?>
In order to obtain the name of the month in 2 cases instead of its sequence number:
<?
echo $MESS['MONTH_'.date('n')]; // June
echo $MESS['MONTH_'.date('n').'_S']; // July
?>
The same procedure is applicable to the days of the week, names of the countries, etc.