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(a)gmail.com> wrote:
On 3/30/07, Javier Valcarce García
<javier.valcarce(a)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));
}
--
Gabriel
Millerd
_______________________________________________
MediaWiki-l mailing
list
MediaWiki-l(a)lists.wikimedia.org
http://lists.wikimedia.org/mailman/listin
fo/mediawiki-l