setlocale for LC_ALL

setlocale for LC_ALL

by Takahiro Kagoya -
Number of replies: 5

Some days before, I posted this:

http://moodle.org/mod/forum/discuss.php?d=8655

Please give me an advice.

But in current version, these lines for setlocale are in moodle_setlocale() function

setlocale (LC_ALL $CFG->locale);
setlocale (LC_TIME, $CFG->locale);
setlocale (LC_COLLATE, $CFG->locale);

Average of ratings: -
In reply to Takahiro Kagoya

Re: setlocale for LC_ALL

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi,

I never saw that earlier one ... the best place for actual bug reports and fixes is the bug tracker.

The LC_ALL call has always been in Moodle ... and it usually works fine, for example see the Japanese course on moodle.org which uses the default locale string set in the language pack.
In reply to Martin Dougiamas

Re: setlocale for LC_ALL

by Takahiro Kagoya -

Hi. Thank you, Martin.

Martin> the best place for actual bug reports and fixes is the bug tracker.

Yes, 2 month before, I found this problem, and Timothy Takemoto has reported about this bug in bug tracker.

http://moodle.org/bugs/bug.php?op=show&bugid=1619

Martin> The LC_ALL call has always been in Moodle.

I can't find LC_ALL in moodle_setlocale() function.

Martin>for example see Japanese course on modle.org whick...

Yes, I know this course is running with no problem. But I built the Moodle sites on the MS-Windows ( I have 2 site, IIS and Win-Apache).

In both site, if I add the setlocale(LC_ALL,$CFG->locale) these problem is solved.

In reply to Takahiro Kagoya

Re: setlocale for LC_ALL

by Marco Antonio -

Hi Taka Kago

I'm founding several dates and times troubles with our brazilian portuguese settings for locale. We're using 1.4 version. In that version I don't found that line for change by hand. What's version do you use now?

It's possible to insert that line in 1.4 version and works?

Thanks in advance

Marco

In reply to Marco Antonio

Re: setlocale for LC_ALL

by Takahiro Kagoya -

Maybe you can find the  funcion moodle_setlocale in lib/moodlelib.php.

Then, I add this line on every version up :

    setlocale (LC_ALL, $CFG->locale);

befor these lines

    setlocale (LC_TIME, $CFG->locale);
    setlocale (LC_COLLATE, $CFG->locale);

http://cvs.sourceforge.net/viewcvs.py/moodle/moodle/lib/moodlelib.php?rev=1.392&view=markup

Try.

In reply to Takahiro Kagoya

Re: setlocale for LC_ALL

by Takahiro Kagoya -

self-reply for my old article...

I moved LC_CTYPE setting before LC_TIME setting in moodle_setlocale function like this:

    if ($CFG->locale != 'tr_TR') {            // To workaround a well-known PHP bug with Turkish
        setlocale (LC_CTYPE, $CFG->locale);
    } 

    setlocale (LC_TIME, $CFG->locale);
    setlocale (LC_COLLATE, $CFG->locale);

This change fixed Japanese date string problem.  I can't know why LC_CTYPE must be before LC_TIME. But please fix this