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 ...

Get Elgg 1.8 Social Networking now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.