[pmwiki-users] setXL to change language of the page?

Thomas -Balu- Walter list+pmwiki-users at b-a-l-u.de
Thu Aug 3 09:48:44 CDT 2006


Hi all,

not being able to find a directive that allows me to change the language
of a page I thought I'd give it a trying with the following code:

Markup('setXL', '>$[phrase]',
    '/\\(:setXL\\s+(\\S.*?):\\)/ei',
    "setXL('$1')"
);

function setXL($langs)
{
    global $XLLangs;
    $args = ParseArgs($langs);
    $XLLangs = $args[""];
}

This adds a new directive (:setXL <languages>:). <languages> is a space
separated list of the languages with the first one being preferred (e.g.
"de en").

Those languages have to be loaded first using XLPage();

This is just a quick hack, so it might be the most evil piece of code in
the world until Pm says something different ;).

     Balu
PS: I've noticed that my $XLLangs contains "de" two times - perhaps
because I've loaded two pages - the default and my local one? Is this
a feature or a minor bug that eats some ressources when searching for
translations?




More information about the pmwiki-users mailing list