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
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

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 3 guests