Hi all,
I manage a private wiki for an organization whose users are both English and French. They would like to be able to use some of the Date & Time variable Magic Words, having the results displayed in the users' language of choice. So, using {{CURRENTDAY}} would produce either "Monday" or "Lundi", depending. I was rather surprised to see that just changing my user's preferences did not force this translation automatically, as it does for the interface and navigation links.
When my language preferences are set to either "En" or "Fr", using the Magic Word {{LOCALMONTHNAME}} produces "August", invariably.
Do I have to create a new extension to handle this kind of functionality, or should this just work and I am suffering from some unknown pilot error?
Thanks,
John
John Thomson wrote:
Hi all,
I manage a private wiki for an organization whose users are both English and French. They would like to be able to use some of the Date & Time variable Magic Words, having the results displayed in the users' language of choice. So, using {{CURRENTDAY}} would produce either "Monday" or "Lundi", depending. I was rather surprised to see that just changing my user's preferences did not force this translation automatically, as it does for the interface and navigation links.
When my language preferences are set to either "En" or "Fr", using the Magic Word {{LOCALMONTHNAME}} produces "August", invariably.
Do I have to create a new extension to handle this kind of functionality, or should this just work and I am suffering from some unknown pilot error?
Thanks,
John
Since they are content, they appear in the wiki content language. If you want to have it shown in the users language, open includes/parser/parser.php and at function getVariableValue change $wgContLang to $wgLang (remember to do a global $wgContLang). But you will need to disable caching there to avoid an "English" user viewing the French months after a "French" user visited the page.
Platonides wrote:
John Thomson wrote:
Hi all,
I manage a private wiki for an organization whose users are both English and French. They would like to be able to use some of the Date & Time variable Magic Words, having the results displayed in the users' language of choice. So, using {{CURRENTDAY}} would produce either "Monday" or "Lundi", depending. I was rather surprised to see that just changing my user's preferences did not force this translation automatically, as it does for the interface and navigation links.
When my language preferences are set to either "En" or "Fr", using the Magic Word {{LOCALMONTHNAME}} produces "August", invariably.
Do I have to create a new extension to handle this kind of functionality, or should this just work and I am suffering from some unknown pilot error?
Thanks,
John
Since they are content, they appear in the wiki content language. If you want to have it shown in the users language, open includes/parser/parser.php and at function getVariableValue change $wgContLang to $wgLang (remember to do a global $wgContLang). But you will need to disable caching there to avoid an "English" user viewing the French months after a "French" user visited the page.
Fantastic! Thanks, Platonides!! Worked like a charm!
Thanks to you as well, Lukasz. You've both been tremendously helpful to me.
John
"JT" == John Thomson john@stonewayconsulting.ca writes:
JT> Platonides wrote:
open includes/parser/parser.php and at function getVariableValue change $wgContLang to ...
JT> Fantastic! Thanks, Platonides!! Worked like a charm! The headaches will of course reappear when you one day upgrade Mediawiki and the file gets overwritten and you don't remember what you changed...
On Mon, Aug 24, 2009 at 11:05 PM, John Thomsonjohn@stonewayconsulting.ca wrote:
Hi all,
I manage a private wiki for an organization whose users are both English and French. They would like to be able to use some of the Date & Time variable Magic Words, having the results displayed in the users' language of choice. So, using {{CURRENTDAY}} would produce either "Monday" or "Lundi", depending. I was rather surprised to see that just changing my user's preferences did not force this translation automatically, as it does for the interface and navigation links.
When my language preferences are set to either "En" or "Fr", using the Magic Word {{LOCALMONTHNAME}} produces "August", invariably.
Do I have to create a new extension to handle this kind of functionality, or should this just work and I am suffering from some unknown pilot error?
You must first understand the difference between the language of the wiki (ContentLanguage) and the language set in the user's preferences (UserLanguage).
While UserLanguage may change from user to user, and even for the same user as he modifies his preferences, ContentLanguage stays the same for any given wiki and will not change.
UserLang is used to display the correct *interface* to the user, while ContentLanguage is used to display the *content* or *article*.
You are using the magic words mentioned within the article, which means that, quite logically, ContentLanguage governs how they are interpreted and rendered.
This is not a bug, but rather a matter of design.
mediawiki-l@lists.wikimedia.org