Wikimedia Developer Support

$wgLanguageCode does not change Tools menu

wiki-farms
settings
language

#1

I have 11 separate wikis all running off the same code base but with 11 databases and 11 (or more) LocalSettings.php files that get included according to the language/wiki ID at

  1. https://fswiki.qualitybox.us/wiki/en
  2. https://fswiki.qualitybox.us/wiki/de
  3. https://fswiki.qualitybox.us/wiki/es
    etc.

I’d like to have the ‘Tools’ menu appear in the language of the wiki. So, if I visit the Spanish wiki, the Tools menu links would be in Spanish. No matter what setting I have for $wgLanguageCode, the links are in English (even browsing in incognito mode). I’ve flushed the language interface messages cache with
WIKI=en php /opt/htdocs/mediawiki/maintenance/rebuildmessages.php
WIKI=de php /opt/htdocs/mediawiki/maintenance/rebuildmessages.php
WIKI=es php /opt/htdocs/mediawiki/maintenance/rebuildmessages.php
etc.

The Tools Menu is properly translated if I append ?uselang=xx (where xx is ‘es’ for Spanish) to the URL Vis. example: https://fswiki.familysearch.org/wiki/es/?uselang=es However, I want the same behavior without manipulating the URL with ‘uselang’.

What am I missing? Why doesn’t $wgLanguageCode work as advertised?


#2

이상준

2019년 3월 23일 (토) 01:44, Greg Rundlett via Wikimedia Developer Support noreply@discourse-mediawiki.wmflabs.org님이 작성:


#3

Looks like your wiki is using the language preference of the browser of users viewing your site, because I see the tools menu of all three wikis in Spanish! I think this is a side effect of having the UniversalLanguageSelector extension installed


#4

Confirmed. Disabling ULS results in the expected behavior where interface language is controlled by wgLanguageCode. Enabling ULS results in the interface language being controlled by the user’s browser settings (language preferences encoded in Accept headers).


#5

Not so much a side effect as one of the main features (which wikis not heavily reliant on caching should probably enable). You can turn it off with $wgULSLanguageDetection = false; if you really want.


#6

That’s what I though at first, but such an important feature is not even documented on the extension’s page…


#7

Yeah, the doc page is not great. extension.json is usually a more reliable source of information.