[pmwiki-users] markup function and i18n

Patrick R. Michaud pmichaud at pobox.com
Tue Dec 20 15:21:08 CST 2005


On Tue, Dec 20, 2005 at 09:13:55PM +0000, Hans wrote:
> I try to use square brackets for internationalising some text strings
> in the substitution part of a custom markup function.
> But $[text string] is just passed on as is, not processed by i18n.
> 
> Oddly doing the same in the $HTMLStylesFmt function works fine.
> 
> How can I get i18n working in the markup function?

$[text string] and {$PageVar} are processed very early in the
markup sequence -- in fact, I think that only [=...=] and [@...@]
escapes are processed earlier.  So, in order to use $[...] a markup
rule that occurs later in the sequence has to do some extra work:

1.  It can call the PRR() function, which tells the markup engine
    to restart processing the current text with the first markup
    rule (thus any $[...], page variables, and [=...=] sequences
    are processed).

       Markup('something', 'somewhere',
         '/some pattern/e',
         "PRR('markup containing $[text string]')");

2.  It can call FmtPageName directly to do the conversion.
    Be careful with this one, as FmtPageName will also substitute
    the values of global variables, which might not be what you
    want.

       Markup('something', 'somewhere',
         '/some pattern/e',
         "FmtPageName('markup containing $[text string]', \$pagename)");
  
Pm 




More information about the pmwiki-users mailing list