Elgg  Version 1.9
Functions | Variables
languages.js File Reference

Go to the source code of this file.

Functions

elgg provide ('elgg.config.translations')
 Provides language-related functionality. More...
 

Variables

elgg config language = 'en'
 
elgg add_translation
 Analagous to the php version. More...
 
elgg get_language
 Get the current language. More...
 
elgg echo
 Translates a string. More...
 

Function Documentation

elgg provide ( 'elgg.config.translations )

Provides language-related functionality.

Variable Documentation

elgg add_translation
Initial value:
= function(lang, translations) {
elgg.provide('elgg.config.translations.' + lang);
elgg.extend(elgg.config.translations[lang], translations);
}
elgg
Definition: install.js:23
$CONFIG translations
String translations for the current language.
Definition: config.php:48

Analagous to the php version.

Merges translations for a given language into the current translations map.

Definition at line 14 of file languages.js.

elgg echo
Initial value:
= function(key, argv, language) {
if (elgg.isString(argv)) {
language = argv;
argv = [];
}
var translations = elgg.config.translations,
dlang = elgg.get_language(),
map;
language = language || dlang;
argv = argv || [];
map = translations[language] || translations[dlang];
if (map && map[key]) {
return vsprintf(map[key], argv);
}
return key;
}
elgg
Definition: install.js:23
elgg config language
Definition: languages.js:8
$CONFIG translations
String translations for the current language.
Definition: config.php:48

Translates a string.

Parameters
{String}key The string to translate
{Array}argv vsprintf support
{String}language The language to display it in
Returns
{String} The translation

Definition at line 43 of file languages.js.

elgg get_language
Initial value:
= function() {
var user = elgg.get_logged_in_user_entity();
if (user && user.language) {
return user.language;
}
return elgg.config.language;
}
elgg
Definition: install.js:23
elgg menu user
Definition: admin.php:190

Get the current language.

Returns
{String}

Definition at line 24 of file languages.js.

elgg config language = 'en'

Definition at line 8 of file languages.js.