[pmwiki-users] XLPage()

Stirling Westrup sti at pooq.com
Tue Sep 18 11:35:27 CDT 2007


As part of this multilingual site I'm creating, I've been playing around with
XLPage() and the various other XL...() mechanisms for handling translations.
I've noticed a few things that I would like, but that would probably involve
changes to the core:

1) Right now, every time you call XLPage(), and it loads anything, it
unconditionally adds the language tag to the end of $XLLangs, even if its
already there. Thus a sequence of commands like

  XLPage('fr',"$Group.XLPageLocal");    # group local translations
  XLPage('fr','PmWikiFr.XLPageLocal');  # my local translations
  XLPage('fr','PmWikiFr.XLPage');       # from i18n.tgz

Ends up with 'fr' showing up three times in $XLLangs. I think this implies
that an untranslated phrase like $[FOO] will be looked up three times in
$XL['fr'] before PmWiki decides it doesn't exist. It also means that one
cannot stop using a loaded translation just by doing an array_shift($XLLangs);

It should be fairly straightforward to only append a language tag if its not
already in the language list, shouldn't it?

2) I've sometimes found myself wanting to translate a phrase OUT of the
current language, not into it. Thus, in English text I may want to say
something like: "While the menu will say 'edit' before you've selected a
language, it will change to '$[edit]' after you choose French." This is
especially important when such strings are being auto-generated.

Now, naturally that isn't going to work, without some way to tell PmWiki what
language to translate something into. I would love to have a way to specify a
target translation mechanism like $[fr|edit] or something that could do that,
but I fear that it might have a large impact on how PmWiki handles current
translations. What do people think?



More information about the pmwiki-users mailing list