2007/10/08

Wrong month names in Calendar

I encountered problem when you are running multi-lang site with month names in moodle Calendar.

I had courses which were forcing another language than my main language. Blocks and everything have been showing correctly, only dates were showing in my main language.

After some test i found, it's problem with locales setting on the server.

Locales are set of parameters that defines user's language, user's currency, user's date formatting. Not all countries have same style of displaying dates, not mentioning that every language represent different months names.

Every moodle lang pack has set these localales setting, you can find it in two files:
moodle/lang/yourlangpack/langconfig.php
line $string['locale'] = 'somelocalesetting';

and
moodle/lang/yourlangpack/moodle.php
line $string['locale'] = 'somelocalesetting';


In my case it was set up to en_AU.iso88591.

I don't know, why it is on two places, same setting, maybe langconfig.php file holds more settings and you may alter them by your wish. Either way, you may want to change these settings to locales you have set up on your server.

In my case, my server didn't have en_AU.iso88591 locale installed. On unix server you can find all installed locales with command locale -a.

You have two ways how to solve this problem.


  • One: Install this locale to your server (or ask your administrator, if you have one, to install it for you)

  • Second: Pick up another locale setting you have installed and its shown by locale -a command.



I changed 'somelocalesetting' to one of my installed locales settings for english language and now it's working correctly.

2 comments:

Pradeep said...

Ah, good one. This solved my problem where month names coming up in english even when I selected a different language.

PK said...

I am glad I could helped. I spent a insanely large amount of time on this problem, tearing my hairs, but it was really easy in the end as many ingenious things are ;-).