[ic] interpolate

Kevin Walsh kevin at cursor.biz
Fri Mar 24 10:02:04 EST 2006


"Elver Loho" <elver.loho at gmail.com> wrote:
> Riddle me this.
> 
To the batmobile - let's go!

>
> We're using a custom tag (lc2) for translations. It basically
> retrofits the LC tags onto the L tag database and unifies the two so
> we have a centralised translation system.
> 
> Now we want to use stuff like __VARIABLES__ in them.
> 
> Thing is, it "doesn't work."
> 
> [lc2 some_id_code]default message[/lc2]
> 
> Works fine, displays the right message according to the current
> locale, but doesn't replace __VARIABLES__
> 
> [lc2 some_id_code interpolate=1]default message[/lc2]
> 
> Replaces __VARIABLES__, but *ALWAYS* displays the 'default message' part.
> 
> What giveth?
> 
Well, firstly, it looks as if you're mixing positional and named
parameters.  You can either do [lc2 first second] or
[lc2 foo=first bar=second], but not mix the two.  That'll be
the reason why you always get the default message when you do that.

Secondly (and the solution to your main problem) your stored text
will need to contain references to "[var SOMEVAR]" instead of simply
"__SOMEVAR__".  The default message will contain the value of
__SOMEVAR__ variables, as expected, because they will be replaced
in the text when the page is first loaded.  Variables in your
looked-up messages will not be replaced in that way  That'll be the
reason why you see the value of __SOMEVAR__ in the default message,
but not in messages you grab from your database.

I'm still not entirely clear why you need a [lc2] tag at all, but
that's another matter.

I'll get my cape and be on my way. :-)

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin at cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/


More information about the interchange-users mailing list