[pmwiki-users] XLpage: 1st parameter?

Patrick R. Michaud pmichaud at pobox.com
Tue Oct 3 10:33:21 CDT 2006


On Tue, Oct 03, 2006 at 12:58:21PM +0200, Mike wrote:
>    the XLpage function takes two parameters: the second specifies where the
>    translations are to come from - easily understood. But why do I need the
>    first parameter?
> 
>    If in
>    XLPage('fr','PmWikiFr.XLPage');
> 
>    I'd write instead:
>    XLPage('strangelanguage','PmWikiFr.XLPage');
> 
>    then after all PmWiki would still retrieve translation strings from
>    PmWikiFr.XLPage, i.e. translate into French, no matter what I wrote for
>    the first parameter?

The XLPage mechanism allows multiple sets of translations to be loaded,
and the first parameter is used to distinguish them.  

For example, suppose I want to have translations for both normal French
and "Canadian" French.  Rather than maintain two entirely separate sets
of pages, I could do:

    XLPage('fr', 'PmWikiFr.XLPage');
    XLPage('fr-ca', 'PmWikiFrCa.XLPage');

PmWikiFr.XLPage would contain all of the standard French translations,
while PmWikiFrCA.XLPage would only need to contain "Canada-specific"
translations -- i.e., those that are different from the ones in the
French page.

The first parameter distinguishes the two sets of translations.
In addition, a config.php script can use the $XLLangs variable
to adjust the order of translation, so if there was a group or
page where I only wanted the standard French translation, I
can set

    $XLLangs = array('fr', 'en');

and PmWiki will use only the 'fr' and 'en' translations (in that order),
no matter how many translations have been loaded with XLPage().

Hope that explains things well enough...

Pm





More information about the pmwiki-users mailing list