Elgg  Version 1.11
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 ()
 Detect the current language being used by the current site or logged in user. More...
 
 get_language ()
 Gets the current language in use by the system or user. More...
 
 _elgg_load_translations_for_language ($language)
 Load both core and plugin translations for a specific language. More...
 
 register_translations ($path, $load_all=false)
 When given a full path, finds translation files and loads them. More...
 
 _elgg_register_translations_for_language ($path, $language)
 When given a full path, finds translation files for a language 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 give language key exists. More...
 
 _elgg_translations_init ()
 Initializes simplecache views for translations. More...
 

Variables

return function (\Elgg\EventsService $events)
 

Function Documentation

_elgg_load_translations_for_language (   $language)

Load both core and plugin translations for a specific language.

This can be used to load translations on-demand in case we need to translate something to a language not loaded by default for the current user.

Parameters
$languageLanguage code
Returns
bool
Since
1.9.4
Exceptions
PluginExceptionprivate

Definition at line 74 of file languages.php.

_elgg_register_translations_for_language (   $path,
  $language 
)

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

This function was added in 1.9.4 to make it possible to load translations for individual languages on-demand. This is needed in order to send notifications in the recipient's language (see #3151 and #7241).

private

Since
1.9.4
Parameters
string$pathFull path of the directory (with trailing slash)
string$languageLanguage code
Returns
bool success

Definition at line 161 of file languages.php.

_elgg_translations_init ( )

Initializes simplecache views for translations.

Returns
void

Definition at line 258 of file languages.php.

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 give language key exists.

Parameters
string$keyThe translation key
string$languageThe language
Returns
bool
Since
1.11

Definition at line 249 of file languages.php.

get_current_language ( )

Detect the current language being used by the current site or logged in user.

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

get_language ( )

Gets the current language in use by the system or user.

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

register_translations (   $path,
  $load_all = false 
)

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
Returns
bool success

Definition at line 140 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 203 of file languages.php.

Variable Documentation

Definition at line 269 of file languages.php.