[pmwiki-users] bilingual

Hans design5 at softflow.co.uk
Wed Feb 6 02:24:04 CST 2008

Wednesday, February 6, 2008, 12:32:29 AM, nikos roussos wrote:

> what's the proper way to make a bilingual site with pmwiki using the same
> skin?

I recommend putting different language sections in each page, and have
one of them displayed, by user choice.

I tried http://www.pmwiki.org/wiki/Cookbook/MultiLanguage
which does exactly that, offering markup like

(:if userlang en:)
english text
(:if userlang gr:)
greek text
common text

but i had problem with that recipe, especially using th elanguage
conditional in the sidebar.

So i use http://www.pmwiki.org/wiki/Cookbook/ViewModes
instead. You get a (:if view ...:) conditional, a setview= action to
set a view cookie, and a {$View} page variable.
I redefined the $ViewList array, before including the script in
config.php, like

$ViewList, array(
        'en' => 'en',
        'de' => 'de',
        'gr' => 'gr',
        'it' => 'it',

and set a default:

$View = 'en';

Then in the pages i use

(:if view en:)
english text
(:if view de:)
deutscher Text
common text

In the sidebar, or header, I put links for setting the 'view'

[[{*$FullName}?setview=en| english]]
[[{*$FullName}?setview=de| deutsch]]

Actually instead of 'english', 'greek' etc text labels i use little
flag images to click on.

[[{*$FullName}?setview=en| Attach:Site/Site/flag-en.gif"english"]]
[[{*$FullName}?setview=de| Attach:Site/Site/flag-de.gif"deutsch"]]

That takes care for multi language content.

It is also possible to use a multi-language wiki interface for all the
action links etc.

I did that in config.php after the views.php is included with

if ($_COOKIE['view'] == 'de') {


The default for pmwiki is english, so does not need to be specified.

The XL translation terms pages get loaded according to the cookie

A slight hitch is that on first page load the default language
interface will show, and only on subsequent page loads the cookie
setting will be taken into account. But this is for me a minor
inconveniance, and only affects the interface.

Hope this gives you some ideas!


More information about the pmwiki-users mailing list