Hello Devs,
I can't log into trac. Therefore I post here.
Most of the plugin localizations are incomplete. I have noticed that the plugin api always defaults to en_US if a language set is missing. This is basically ok because en_US is the "always complete" set.
Nethertheless it should not default to en_US if, f.e., de_DE is present but de_CH is missing. In this case it should load de_DE instead of en_US. Same for pt_BR, if pt_PT is present.
Here is a small patch for class rcube_plugin, method add_texts to archive this behavior:
foreach (array('en_US', $lang) as $lng) {
$fpath = $locdir . $lng . '.inc';
if (is_file($fpath) && is_readable($fpath)) {
include($fpath);
$texts = (array)$labels + (array)$messages + (array)$texts;
}
// begin mod
else {
$atemp = explode('_', $lang);
if ($handle = opendir($locdir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if(strpos($file, '.inc') && substr($file, 0, 2) ==
$atemp[0]){ if (is_file($locdir . $file) && is_readable($locdir . $file)) { include($locdir . $file); $texts = (array)$labels + (array)$messages + (array)$texts; // maybe it would be better not to break and merge all the 'sub' langs break; } } } } closedir($handle); } } // end mod }
Regards, R.