I have seen you can change the interface language by changing the $wgLanguageCode in LocalSettings.pohp and then running rebuildMessages.php but this is a permanent change of interface.
I am looking to allow my Spanish and Italian speaking users the ability to switch to their native language or have it flagged against their user ID when they log in.
So, I log in and see the wiki in English. Manuel logs in and see it in Spanish, Luigi sees it in Italian. Article content is as posted.
Does Mediawiki support this? I understand the article content will be in the language posted but am trying to change the interface, menus etc.
Thanks, Paul
Hi. Logged users have their own interface based on their user's preferences. If you want Content Negotiation (mainly language) for anonymous users I don't know if this is possible. I'm interested also in the latter.
Javi
2007/3/30, Paul Coghlan pcoghlan@usa.net:
I have seen you can change the interface language by changing the $wgLanguageCode in LocalSettings.pohp and then running rebuildMessages.php but this is a permanent change of interface.
I am looking to allow my Spanish and Italian speaking users the ability to switch to their native language or have it flagged against their user ID when they log in.
So, I log in and see the wiki in English. Manuel logs in and see it in Spanish, Luigi sees it in Italian. Article content is as posted.
Does Mediawiki support this? I understand the article content will be in the language posted but am trying to change the interface, menus etc.
Thanks, Paul
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
On 3/30/07, Javier Valcarce García javier.valcarce@gmail.com wrote:
Hi. Logged users have their own interface based on their user's preferences. If you want Content Negotiation (mainly language) for anonymous users I don't know if this is possible. I'm interested also in the latter.
well something like this will work :)
$langs = array( 'en', 'fr', 'he' ); $wgLanguageCode = $langs[(rand()%3)];
if thats not viable something similar to this the following will work as well. it would all be overwritten i guess by either 'if user is logged in use what they have in the database'
$wgLanguageCode = chooseLang($langs);
// a cut and paste from google function chooseLang($availableLangs) { $pref=array(); foreach(split(',', $_SERVER["HTTP_ACCEPT_LANGUAGE"]) as $lang) { if (preg_match('/^([a-z]+).*?(?:;q=([0-9.]+))?/i', $lang.';q=1.0', $split)) { $pref[sprintf("%f%d", $split[2], rand(0,9999))]=strtolower($split[1]); } } krsort($pref); return array_shift(array_merge(array_intersect($pref, $availableLangs), $availableLangs)); }
And in case anyone is looking to automatically control user interface languages from a community platform it is done by changing the line "language=en" in the user_options field (BLOB) in the user table. I will be doing this via an automated trigger.
Paul
On 3/30/07 5:09 PM, "Gabriel Millerd" gmillerd@gmail.com wrote:
On 3/30/07, Javier Valcarce García javier.valcarce@gmail.com wrote: Hi. Logged users have their own interface based on their user's preferences. If you want Content Negotiation (mainly language) for anonymous users I don't know if this is possible. I'm interested also in the latter.
well
something like this will work :)
$langs = array( 'en', 'fr', 'he'
);
$wgLanguageCode = $langs[(rand()%3)];
if thats not viable something
similar to this the following will work
as well. it would all be overwritten i
guess by either 'if user is
logged in use what they have in the
database'
$wgLanguageCode = chooseLang($langs);
// a cut and paste from
function chooseLang($availableLangs) { $pref=array();
foreach(split(',', $_SERVER["HTTP_ACCEPT_LANGUAGE"]) as $lang) {
if
(preg_match('/^([a-z]+).*?(?:;q=([0-9.]+))?/i',
$lang.';q=1.0', $split)) {
$pref[sprintf("%f%d", $split[2],
rand(0,9999))]=strtolower($split[1]);
}
} krsort($pref); return
array_shift(array_merge(array_intersect($pref,
$availableLangs),
$availableLangs));
}
$wgLanguageCode = chooseLang($langs);
// a cut and paste from google function chooseLang($availableLangs) { $pref=array(); foreach(split(',', $_SERVER["HTTP_ACCEPT_LANGUAGE"]) as $lang) { if (preg_match('/^([a-z]+).*?(?:;q=([0-9.]+))?/i', $lang.';q=1.0', $split)) { $pref[sprintf("%f%d", $split[2], rand(0,9999))]=strtolower($split[1]); } } krsort($pref); return array_shift(array_merge(array_intersect($pref, $availableLangs), $availableLangs)); }
This code is very interesting but, where do I put it?
On 30/03/07, Paul Coghlan pcoghlan@usa.net wrote:
I am looking to allow my Spanish and Italian speaking users the ability to switch to their native language or have it flagged against their user ID when they log in.
Yes, just tell them to set their user interface language preference in Special:Preferences.
If using a recent version of MediaWiki, you can also enable the language selection bar for logins and account creation, which might be helpful; see $wgLoginLanguageLinks.
Rob Church
Thanks guys.
The language selection is taking place within Drupal so what I need to do is use a MySQL trigger to change their language (once I find it in the tables) once it is changed within Drupal.
I will have a search to find the language files now.
Paul
On 3/30/07 5:02 PM, "Rob Church" robchur@gmail.com wrote:
On 30/03/07, Paul Coghlan pcoghlan@usa.net wrote:
I am looking to allow my Spanish and Italian speaking users the ability to switch to their native language or have it flagged against their user ID when they log in.
Yes, just tell them to set their user interface language preference in Special:Preferences.
If using a recent version of MediaWiki, you can also enable the language selection bar for logins and account creation, which might be helpful; see $wgLoginLanguageLinks.
Rob Church
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org