November 04, 2005

Mediawiki and Multiple Languages

I was playing with Mediawiki yesterday. My goal was to create a Wiki with definitions of terms in multiple languages. The only documentation I could find makes it sound like creating language links will be something handled automagically by the wiki.

Unfortunately, this is only partially true.

To enable language links for any given language, the language code needs to have an entry in the database table interwiki (this may be prefixed in any MediaWiki installation with the $wgDBprefix if you defined one at install time). This needs to be done with whatever database editing tools you have.

For example, I added English, French, and Czech as languages by inserting the following rows into my database:

mysql> select * from mw_interwiki where iw_prefix in ('en','fr','cs');
+-----------+-----------------------------------------------------+----------+----------+
| iw_prefix | iw_url | iw_local | iw_trans |
+-----------+-----------------------------------------------------+----------+----------+
| cs | http://www.my.site/wiki/index.php?title=cs/$1 | 1 | 0 |
| en | http://www.my.site/wiki/index.php/en/$1 | 1 | 0 |
| fr | http://www.my.site/wiki/index.php/fr/$1 | 1 | 0 |
+-----------+-----------------------------------------------------+----------+----------+
3 rows in set (0.01 sec)

I made the "cs" entry different, mimicking something I saw on a TextBook page, but all the entries appear to do the same thing. When you click on any of the language links, it takes you to a page named, "http://www.my.site/wiki/index.php/Cs/wiki-term"

Posted by rob at November 4, 2005 09:00 AM | TrackBack
Comments
Post a comment









Remember personal info?