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

Re: ePerl and language-dependent output



On Tue, Jul 18, 2000 at 12:43:03PM +0200, Stephan Petersen wrote:
> 
> Hi Denis,
> 
> > If you want, try the code below.  The lang:current variable should
> > always contain current language.
> 
> thanks for the code, that's a *very* useful snippet!
> 
> Now I can write something like this:
> 
> [...]
> 
> <define-tag perl_get_current_lang>
> <perl>
>     my $current_language = qq/<get-var lang:current>/;
>     print "The current language is $current_language\n";
> </perl>
> </define-tag>
> 
> [...]
> 
> <define-tag get_current_lang>
>   <d>
>     <perl_get_current_lang>
>   </d>
>   <e>
>     <perl_get_current_lang>
>   </e>
> </define-tag>
> 
> [...]
> 
> <get_current_lang>
> 
> [...]
> 
> 
> Is there a way to make the per-language calls inside 
> <define-tag get_current_lang> more elegant and "automatic" (so that when
> new languages are addes, they're automatically processed too)?

Just use perl_get_current_lang instead of get_current_lang ;-)
Quite surprisingly it does what you want.

I improved wml::std::lang yesterday at home, but did not commit the
changes, so i will comment them tonight.
They may also help you about the JavaScript problems. With lang:current,
you could check whether Javascript code is inside a lang slice, e.g.

  <define-tag javascript endtag=required>
  <divert HEAD>
  <if <get-var lang:current> "[LANG_<upcase <get-var lang:current>>:">
  [...]
  <if <get-var lang:current> ":LANG_<upcase <get-var lang:current>>]">
  </divert>
  </define-tag>

-- 
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