[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: ePerl and language-dependent output



On Tue, Jul 18, 2000 at 02:12:21PM +0200, Stephan Petersen wrote:

> > > But not when the call to <perl_get_current_lang> is *outside* of any
> > > language-dependent section, right? I mean,
> > > 
> > > <body>
> > > <perl_get_current_lang>
> > > </body>
> > > 
> > > won't work, at least according to my experiments, and what (little) I
> > > understand of wml passes :-)
> > 
> > But 
> >   <body>
> >   <get_current_lang>
> >   </body>
> > will produce the same output.
[...]
> Did you really try it out?

No.

> If I just use <perl_get_current_lang>, the output will be the same in
> both html files, independent of the actual language. If I use
> <get_current_lang>, and thus branch off into the various languages, it
> works fine...

Indeed, i did not understand what this tag was for. 
It is not clear yet what you have in mind, but you may try this to
produce outpuut in all languages:

* with mp4h
  <foreach l __languages>
    <subst-in-string
       "=LT=<get-var l>>=LT=perl_get_current_lang>=LT=/<get-var l>>"
       "=LT=" "<">
  </foreach>
    Strings are evaluated first, then `=LT=' is replaced by `<', and
    resulting string is evaluated again.

* with ePerl
  <:
    foreach (split("\n", qq/<get-var __languages>/)) {
       my $slice = "LANG_" . $_;
       $slice =~ tr/[a-z]/[A-Z]/;
       print "[$slice:The current language is $_\n:$slice]";
    }
  :>

With the latter, you may define an hash array and prints a nice language
name.

-- 
Denis Barbier
WML Maintainer
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com