[horde] Problem with Translation [SOLVED]

sbasurto at soft-gator.com sbasurto at soft-gator.com
Wed Jun 26 16:43:19 UTC 2013


Hello,

I want to share my struggle with Horde translation, I install Horde as
instructions in Horde Site, I read carefully the Translation Guide also,
but the translation did not work for me. Until today that I debug Horde
application an finally find that in the file Registry.php located
at /usr/share/php/Horde/ in the function setLanguage is a variable
called $lang_charset and this variable had HARDCODED 'UTF-8', so if one
of your locales is for example "es_ES.iso88591" it won't work even if
you follow http://www.horde.org/apps/horde/docs/TRANSLATIONS

public function setLanguage($lang = null)
    {
        if (empty($lang) || !$this->nlsconfig->validLang($lang)) {
            $lang = $this->preferredLang();
        }

        $GLOBALS['session']->set('horde', 'language', $lang);

        $changed = false;
        if (isset($GLOBALS['language'])) {
            if ($GLOBALS['language'] == $lang) {
                return;
            }
            $changed = true;
        }
        $GLOBALS['language'] = $lang;

        $lang_charset = $lang . '.UTF-8';        
        if (setlocale(LC_ALL, $lang_charset)) {
            putenv('LC_ALL=' . $lang_charset);
            putenv('LANG=' . $lang_charset);
            putenv('LANGUAGE=' . $lang_charset);
        } else {
            $changed = false;
        }

        if ($changed) {
            $this->rebuild();
        }
    }

So there are two workarounds one is replace the line with the one works
for you in my case:
$lang_charset = $lang . '.iso88591';

or install your locale with UTF-8 support.

I just change that line an everything is working right. I do not know if
is the best way to workaround this but this works for me. I guess a
better way to do it, could be:

exec("locale -a",$locale);
$lang_charset = "";
foreach($locale as $key => $value){
        if(!strstr($value,$lang.'.')){
                ; //do nothign
        }else{
                $lang_charset = $value; 
        }
}


I hope this help someone.


Kind Regards.


More information about the horde mailing list