Elgg  Version 4.x
Functions
languages.php File Reference

Go to the source code of this file.

Functions

 elgg_echo ($message_key, array $args=[], $language="")
 Elgg language module Functions to manage language and translations. More...
 
 add_translation ($country_code, $language_array)
 Add a translation. More...
 
 get_current_language ()
 Get the current system/user language or "en". More...
 
 elgg_language_key_exists ($key, $language= 'en')
 Check if a given language key exists. More...
 

Function Documentation

add_translation (   $country_code,
  $language_array 
)

Add a translation.

Translations are arrays in the Zend Translation array format, eg:

$english = array('message1' => 'message1', 'message2' => 'message2'); $german = array('message1' => 'Nachricht1','message2' => 'Nachricht2');

Parameters
string$country_codeStandard country code (eg 'en', 'nl', 'es')
array$language_arrayFormatted array of strings
Returns
bool Depending on success

Definition at line 35 of file languages.php.

elgg_echo (   $message_key,
array  $args = [],
  $language = "" 
)

Elgg language module Functions to manage language and translations.

Given a message key, returns an appropriately translated full-text string

Parameters
string$message_keyThe short message code
array$argsAn array of arguments to pass through vsprintf().
string$languageOptionally, the standard language code (defaults to site/user default, then English)
Returns
string Either the translated string, the English string, or the original language string.
Examples:
/root/Elgg/engine/lib/output.php.

Definition at line 18 of file languages.php.

elgg_language_key_exists (   $key,
  $language = 'en' 
)

Check if a given language key exists.

Note
Translators should, whenever creating a "dynamically" named language key, always create an English (fallback) translation as well.
Parameters
string$keyThe translation key
string$languageThe language. Provided an English translation exists for all created keys, then devs can generally use the default "en", regardless of the site/user language.
Returns
bool
Since
1.11

Definition at line 61 of file languages.php.

get_current_language ( )

Get the current system/user language or "en".

Returns
string The language code for the site/user or "en" if not set
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 44 of file languages.php.