[pmwiki-users] Questions re Multilingual feature on PmWiki

Hans design5 at softflow.co.uk
Tue Mar 6 08:36:44 CST 2007


Tuesday, March 6, 2007, 1:31:08 PM, Donald wrote:

> If I understand correctly (my reach not infrequently exceeds my grasp in
> some of these things), the multilanguage.php file lets the user's system
> preferences determine the language of interface (per
> http://www.pmwiki.org/wiki/Cookbook/MultiLanguage ). This is apparently
> site-wide ... or can it be only in the wikigroups so defined by adding
> include_once('cookbook/multilanguage.php');
> in the relevant group local/*.php files?

> If one adds the abovementioned line in the config.php file, that would
> surely activate multilanguage in all groups. What happens if there are
> XLpage language preferences already defined for specific wikigroups? Which
> prevails?

multilanguage.php will allow you to create pages with alternative
language content inside the same page, and allows users to chose their
preferred language, so they will see th epage content in their
language. A cookie will hold the users language choice.

The recipe will not change the language of the PmWiki interface, as
the terms displayed for the action links, button labels etc.
These can be displayed in different languages using the XL function
and the respective XL pages. In order for these to switch at user's
choice with multilanguage.php you need to provide switch definitions
for the XLPages, as briefly mentioned on the recipe's cookbook page:

if ($_COOKIE['userlang'] == 'de') {
XLPage('de','PmWikiDe.XLPageCookbook');
XLPage('de','PmWikiDe.XLPage');
XLPage('de','PmWikiDe.XLPageLocal');
}
if ($_COOKIE['userlang'] == 'it') {
XLPage('it','PmWikiIt.XLPageCookbook');
XLPage('it','PmWikiIt.XLPage');
XLPage('it','PmWikiIt.XLPageLocal');
}
etc.

I think it should be okay to install the recipe for selected groups
only in their local/GroupName.php files. There you can also define
which languages a user may select from, using the DefaultLanguages
array, as the example below:

<?php if (!defined('PmWiki')) exit();
# Group.php file

# user languages for this group
$DefaultLanguages = array('en','it','de');
include_once("$FarmD/cookbook/multilanguages.php");


Hans




More information about the pmwiki-users mailing list