Moodle

Chat dates printing does not switch language

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Cannot Reproduce
  • Affects Version/s: 1.8.1
  • Fix Version/s: 1.9.2
  • Component/s: Chat
  • Labels:
    None
  • Environment:
    Php 5.0.23, MySQL 5.2.x Apache 2.0.59, Win XP
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

When using chat in other languages some printings call userdate() without fixing locale

example of location : mod/chat/report.php ยง169

adding the marked line fixes the issue and make userdate print in the correct locale.

else {
$sessionstart = $lasttime;
if ($sessionend - $sessionstart > 60 and count($sessionusers) >= 1) {

>>>> setLocale(LC_TIME, substr(current_language(), 0, 2)); <<<<<
echo '<p align="center">'.userdate($sessionstart).' --> '. userdate($sessionend).'</p>';

print_simple_box_start('center');

Activity

Hide
Dongsheng Cai added a comment -

You don't need to call setlocale before you call userdate, because moodle take care all of these, moodle_setlocale will change locale.

It works very well on my server.

Feel free to reopen it if you still could use date in your language.

Show
Dongsheng Cai added a comment - You don't need to call setlocale before you call userdate, because moodle take care all of these, moodle_setlocale will change locale. It works very well on my server. Feel free to reopen it if you still could use date in your language.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: