[Mediawiki-l] Multilingual Mediawiki?

Javier Valcarce García javier.valcarce at gmail.com
Sat Mar 31 16:19:07 UTC 2007


> $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?



More information about the MediaWiki-l mailing list