Multilingual wiki

This howto was tested with moinmoin 1.7.1 and 1.9.2.

This pages explain how to setup multilangual wikis, using the SisterSites features. It is suitable for wiki in a few languages (in this example: English, French, Spanish)

Limitation:

1. Screenshot

attachment:es.png

attachment:fr.png

2. Foreword

  • From a technical point of view, we are going to setup 1 wiki per language.

3. Copy the files

(We assume you are using Linux, YMMV)

# set a variable, pointing to moin distribution
# (for Debian and Ubuntu packages, this is /usr/share/moin/)
MOINDIST=/path/to/moinuntaredfiles

# First, copy the shared stuffs
mkdir -p /srv/mywiki/data-shared/
cp -r $MOINDIST/data/* /srv/mywiki/data-shared/
cp -r $MOINDIST/underlay /srv/mywiki/

# The copy files for each wiki
mkdir -p /srv/mywiki/data-fr
cp -r $MOINDIST/data/* /srv/mywiki/data-fr/
mv /srv/mywiki/data-fr/user/ /srv/mywiki/data-fr/user.DISABLE

mkdir -p /srv/mywiki/data-es
cp -r $MOINDIST/data/* /srv/mywiki/data-es/
mv /srv/mywiki/data-es/user/ /srv/mywiki/data-es/user.DISABLE

mkdir -p /srv/mywiki/data-en
cp -r $MOINDIST/data/* /srv/mywiki/data-en/
mv /srv/mywiki/data-en/user/ /srv/mywiki/data-en/user.DISABLE

# The webserver but be able to read/write files
chown -R www-data:www-data /srv/mywiki/

4. Configure the web server

As we mentioned above, we setup 3 wikis. There is nothing special here. (This example is for Apache).

### Serve static contents (images, javascript, css...) ###
# The path to static contents changes (named after moinmoin version).
AliasMatch "^/moin_static[0-9]*/(.*)" "/usr/share/moin/htdocs/$1"
<Directory "/usr/share/moin/htdocs/">
        Options -Indexes -FollowSymlinks
        AllowOverride None
</Directory>


### Serve the wiki as /wiki ###
WSGIScriptAlias /en "/usr/share/moin/server/moin.wsgi"
WSGIScriptAlias /fr "/usr/share/moin/server/moin.wsgi"
WSGIScriptAlias /es "/usr/share/moin/server/moin.wsgi"

<Directory "/usr/share/moin/server/">
        Options -Indexes -FollowSymlinks
        AllowOverride None
</Directory>

5. Configure the wikifarm

5.1. Configure Interwiki map

Each wiki is has two InterWiki name, like MyWikiEn and English. The first one is the real one, the second is used to nicely display the page header

/srv/mywiki/data-shared/intermap.txt should look like:

5.2. farmconfig.py

Let's declare the wikis we are going to use. Let's modify wiki=[] in your farmconfig.py

wikis = [                                                            
                                                                     
    # wikiname, url regular expression                               
    # ---------------------------------------------------------------
    ("mywiki-en", r"^http://example\.com/en.*$"),   # MyWiki - English
    ("mywiki-fr", r"^http://example\.com/fr.*$"),   # MyWiki - French
    ("mywiki-es", r"^http://example\.com/es.*$"),   # MyWiki - Spanish
    #("mywiki", r".*"),   # this is ok for a single wiki
                                                                     
    # for multiple wikis, do something like this:                    
    #("wiki1", r"^http://wiki1\.example\.org/.*$"),                  
    #("wiki2", r"^https?://wiki2\.example\.org/.*$"),                
]                                                                    

Full example: farmconfig.py

5.3. wiki setup

Let's create one wiki for each language (/etc/moin/mywiki-en.py, /etc/moin/mywiki-fr.py, /etc/moin/mywiki-es.py). the configuration files are almost identical for all languages, except interwikiname, data_dir, language_default and sistersites.

We are using quite a few tips here:

This is the example for /etc/moin/mywiki-en.py:

and also mywiki-en.py, mywiki-fr.py, mywiki-es.py.

5.4. Usual configuration

Now, you can do the usual configuration (create a user account, grant superuser rights, visit http://example.com/en/LanguageSetup ...)

6. Synchronise content

The wiki won't magically know that a page appeared on the other wikis. For each language, you have to tell moinmoin to poll the sister sites. in our example, using:

You can create a cron job (or a windows task) to automate this.

7. Beyond ...

8. See also

MoinMoin: HowTo/MultilingualWiki(sistersites) (last edited 2010-03-21 13:15:38 by FranklinPiat)