The register_translation function in languages.php register all translations, even
if they are not registered for the core-system.
But you can't access such languages.
Example :
For the core-system you have languages-files for EN, DE, FR.
A plugin that you want to us comes with languages-files for EN, DE, FR, PL, ES, NL, XX.
So all this languages will be registered and added to the translation-array. But there is not possibility for the user to access PL, ES, NL, XX.
A small patch will fixe this :
The original function is :
/**
* When given a full path, finds translation files and loads them
*
* @param string $path Full path
*/
function register_translations($path) {
global $CONFIG;
if (isset($CONFIG->debug) && $CONFIG->debug == true) error_log("Translations loaded from : $path");
if ($handle = opendir($path)) {
while ($language = readdir($handle)) {
if (!in_array($language,array('.','..','.svn','CVS', '.DS_Store', 'Thumbs.db',)) && !is_dir($path . $language)) {
@include($path . $language);
}
}
}
else
error_log("Missing translation path $path");
}
This should be replaced with :
/**
* When given a full path, finds translation files and loads them
*
* @param string $path Full path
* @param boolean $core Core-translation or Plugin-translation
*/
function register_translations($path, $core = false)
{
global $CONFIG;
if (isset($CONFIG->debug) && $CONFIG->debug == true) error_log("Translations loaded from : $path");
if ($core == TRUE) {
// All core-languages should be registered
if ($handle = opendir($path)) {
while ($language = readdir($handle)) {
if (!in_array($language,array('.','..','.svn','CVS', '.DS_Store', 'Thumbs.db',)) && !is_dir($path . $language)) {
@include($path . $language);
}
}
} else {
error_log("Missing translation path $path");
}
} else {
// Only register those plugin languages, wich are alreday registerd in core,
// because there is no possibility to use an other language
$languages = get_installed_translations();
foreach ($languages AS $languageKey => $languageName) {
if (is_file($path . $languageKey . '.php')) {
@include($path . $languageKey . '.php');
}
}
}
}
And in the last line of languages.php add a TRUE to the registration of the core-languages
register_translations(dirname(dirname(dirname(__FILE__))) . "/languages/", TRUE);
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.