Internationalization and localization
Elgg uses the function elgg_echo()
to handle the internationalization of user interface text. The function is passed a string identifier and it is mapped to the appropriate string in the viewer's language:
$title = elgg_echo('file:yours');
The mappings are stored in language files named according to the language code (en.php
has the English mapping). The mappings are associative arrays:
$english = array( 'item:site' => 'Sites', 'login' => 'Log in', … 'tags:site_cloud' => 'Site Tag Cloud', );
The language files for a plugin are located in its languages directory: /mod/<plugin name>/languages/
. A mapping defined in the core or in a plugin can be overridden in a plugin. Plugin loading order determines which string is used if more than one plugin defines a mapping. Plugin language files are automatically loaded by the Elgg engine.
Code location
Core language file: /languages/en.php
Plugin language files: /mod/<plugin name>/languages/en.php