OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



setlocale bug

Open Harvester Systems support questions and answers, bug reports, and development issues.

Moderators: jmacgreg, michael, John

Forum rules
Developer Resources:

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome.

setlocale bug

Postby anakin » Thu Mar 31, 2011 6:54 am

Hi, i'am a programmer from Türkiye, i find a bug on OHS.

In /var/www/lib/pkp/classes/i18n/PKPLocale.inc.php file there is a wrong setlocale parameter. On linux systems if you use

setlocale(LC_ALL, 'tr_TR'^) you will get fatal errors... because php can not find any class in this case. you must use

setlocale(LC_MESSAGES, 'tr_TR') instead. so i changed the code. This solves all translation problems in this forum... enjoy...

// on line 101
if (!@setlocale(LC_MESSAGES, $sysLocale, $locale)) {
// For PHP < 4.3.0
if(setlocale(LC_MESSAGES, $sysLocale) != $sysLocale) {
setlocale(LC_MESSAGES, $locale);
}
}
anakin
 
Posts: 2
Joined: Thu Mar 31, 2011 6:38 am

Re: setlocale bug

Postby anakin » Sat Apr 02, 2011 11:34 am

i modified the code like this (for windows and linux)

Code: Select all
if(strstr(PHP_OS, 'WIN')){
    if (!@setlocale(LC_ALL, $sysLocale, $locale)) {
        // For PHP < 4.3.0
        if(setlocale(LC_ALL, $sysLocale) != $sysLocale) {
            setlocale(LC_ALL, $locale);
        }
    }   
} else {
    if (!@setlocale(LC_MESSAGES, $sysLocale, $locale)) {
        // For PHP < 4.3.0
        if(setlocale(LC_MESSAGES, $sysLocale) != $sysLocale) {
            setlocale(LC_MESSAGES, $locale);
        }
    }
}


Important Note:
you must run this command on linux systems if the translation language not supported
Code: Select all
dpkg-reconfigure locales

and select your language code
anakin
 
Posts: 2
Joined: Thu Mar 31, 2011 6:38 am


Return to Open Harvester Systems Support and Development

Who is online

Users browsing this forum: No registered users and 2 guests

cron