Namespaces for languages
From ThorstensHome
Home < Tutorials < Hacking MediaWiki < Namespaces for languages
- Scenario
- You want your mediawiki installation to have articles in different languages. You want that by default, your users only see articles in their browser's language.
- Solution
- Install a DE namespace for your wiki. Do as described in http://www.mediawiki.org/wiki/Manual:Using_custom_namespaces. For this tutorial, we assume DE is namespace 100.
- Add the following to your LocalSettings.php:
$wgNamespacesToBeSearchedDefault = array(
NS_MAIN => true,
100 => true
);
if (strpos($_SERVER['HTTP_ACCEPT_LANGUAGE'],"de")===false)
{
$wgNamespacesToBeSearchedDefault[100]=false;
}
- start your firefox (in this tutorial we assume it is 3.0.10), add "German" (de) under Edit=>Preferences=>Content=>Languages
- LOG OUT from your wiki to get rid of the search user preferences
- go to your wiki and click on "search". Verify "DE" is tagged.
- remove "German" (de) under Edit=>Preferences=>Content=>Languages
- go to your wiki and click on "search". Verify "DE" is not tagged.

