Elgg  Version 2.3
Namespaces | Functions | Variables
languages.php File Reference

Go to the source code of this file.

Namespaces

 Elgg\Core
 Activate a plugin or plugins.
 

Functions

 elgg_echo ($message_key, $args=array(), $language="")
 Given a message key, returns an appropriately translated full-text string. More...
 
 add_translation ($country_code, $language_array)
 Add a translation. More...
 
 get_current_language ()
 Get the current system/user language or "en". More...
 
 get_language ()
 Detect the current system/user language or false. More...
 
 register_translations ($path, $load_all=false, $language=null)
 When given a full path, finds translation files and loads them. More...
 
 reload_all_translations ()
 Reload all translations from all registered paths. More...
 
 get_installed_translations ()
 Return an array of installed translations as an associative array "two letter code" => "native language name". More...
 
 get_language_completeness ($language)
 Return the level of completeness for a given language code (compared to english) More...
 
 get_missing_language_keys ($language)
 Return the translation keys missing from a given language, or those that are identical to the english version. More...
 
 elgg_language_key_exists ($key, $language= 'en')
 Check if a given language key exists. More...
 

Variables

return function (\Elgg\EventsService $events)
 

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 38 of file languages.php.

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

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, and /root/Elgg/engine/lib/views.php.

Definition at line 21 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 133 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

Definition at line 47 of file languages.php.

get_installed_translations ( )

Return an array of installed translations as an associative array "two letter code" => "native language name".

Returns
array

Definition at line 93 of file languages.php.

get_language ( )

Detect the current system/user language or false.

Returns
string The language code (eg "en") or false if not set

Definition at line 56 of file languages.php.

get_language_completeness (   $language)

Return the level of completeness for a given language code (compared to english)

Parameters
string$languageLanguage
Returns
int

Definition at line 104 of file languages.php.

get_missing_language_keys (   $language)

Return the translation keys missing from a given language, or those that are identical to the english version.

Parameters
string$languageThe language
Returns
mixed

Definition at line 116 of file languages.php.

register_translations (   $path,
  $load_all = false,
  $language = null 
)

When given a full path, finds translation files and loads them.

Parameters
string$pathFull path
bool$load_allIf true all languages are loaded, if false only the current language + en are loaded
string$languageLanguage code if other than current + en
Returns
bool success

Definition at line 70 of file languages.php.

reload_all_translations ( )

Reload all translations from all registered paths.

This is only called by functions which need to know all possible translations.

Returns
void

Definition at line 83 of file languages.php.

Variable Documentation

return function(\Elgg\EventsService $events)

Definition at line 137 of file languages.php.