<< Back
Message for this thread
Posted by Messages text
Dimitar Dimitrov

Noavatar
Total post : 4
> Profile
Written on : 25/01/2006 10:47 ( more than one month )
Object : Language Problem
Hi,  We are testing docebo and we find it very functional and well implemented.
We would like to  introduce it as a  platform for our e-learning activities, but currently we have a problem with the languages.
We would like to use Bulgarian (cyrillic)  and  to set the  system  to utf-8.
It is set to utf-8, but  the texts  apear  as single  byte (instead  to see  proper 2 bytes  letter, we  see 2  letters/symbols)
Could you give us a hint what we are doing wrong, or what should be corrected in the system.

Thank you,
Dimitar
 
Dimitar Dimitrov

Noavatar
Total post : 4
> Profile
Written on : 25/01/2006 12:00 ( more than one month )
Object : Re: Language Problem
Hi,
I found the solution, but it has to be tested:
in docebocore/lib/lib.utils.php
====================================================
function translateChr( &$text, &$translate_table, $reverse = false ) {
    /* original code
    if(!is_array($translate_table)) return $text;
   
    if($reverse) $translate_table = array_flip($translate_table);
   
    return strtr($text, $translate_table);
    */
    if ($reverse) return html_entity_decode($text,ENT_QUOTES,'utf-8');
    return htmlentities($text,ENT_QUOTES,'utf-8');
}
=====================================================

the hardcoded utf-8 should be replaced with the encoding for the language used.
 
Erba Claudio

Avatar
Total post : 1843
> Profile
Attachment : file
Object : Re: Language Problem
Hello, try the patch attached to this thread, we are testing it since one week
Regards
Claudio
Docebo Staff
http://claudioerba.blogspot.com
 
Dimitar Dimitrov

Noavatar
Total post : 4
> Profile
Written on : 26/01/2006 16:29 ( more than one month )
Object : Re: Language Problem
Hi Claudio,
Thank you for the fast answer. Your code has problems with special characters.
Set the language to utf-8 and try to create course category with name "Test" & Test (with double or single quotes).
I would propose following code:
=======================================================================
function translateChr( &$text, &$translate_table, $reverse = false ) {
   
    if(!is_array($translate_table)) return $text;
    if(!isset($GLOBALS['is_utf'])) $GLOBALS['is_utf'] = ( strpos(getUnicode(), 'utf-8') === false ? false : true );
    if($GLOBALS['is_utf'] === false) {
        if($reverse) $translate_table = array_flip($translate_table);
        return str_replace($translate_table, array_keys($translate_table), $text);
    }
   
    else {
        if ($reverse) return html_entity_decode($text,ENT_QUOTES,'utf-8');
        return htmlentities($text,ENT_QUOTES,'utf-8');   
    }
   
}
===================================================================
Regards,
Dimitar
 
Dimitar Dimitrov

Noavatar
Total post : 4
> Profile
Written on : 30/01/2006 17:56 ( more than one month )
Object : Re: Language Problem
Hi,
The code I proposed above is not usable, because of the global usage of chkInput function. This code would destroy fckEditor entries and for some reason hangs the language  manager.
For the moment the best option is the code you proposed in the attachment.
The problem with double and single quotes in the fields remain, but currently I don't see how to fix it.
If an idea comes I will post it :-)
Regards,
Dimitar
 
<< Back