Re: More ideas for translation support (long)
| From: | Hans-Peter Oeri | Date: | Mon, 23 Jul 2001 15:15:32 +0000 |
| Subject: | Re: More ideas for translation support (long) | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1249@lists.php.net to get a copy of this message | ||
Hi!
Quoting Mike Krus <mwkrus@yahoo.com>:
> yeah, but I set a smarty variable defining the current language, and
> always {include file="lang:$LANG.foo.tpl"}
OK, that should work. But what if you actually try to use the lang: resource AND
something else than files? Wouldn't that mean to write a lang: handler for each
other resource?
What I think we must insist on, is a compiled version per language (for
performance reasons). Actually, this is probably the only point left as we have
prefilters that can do the translation!
Now let's say we change the main engine in a way that some "special" variables
distinguish different compiled versions. Just a sketch of the idea:
We define a list of variables that determine (somehow) distinctively
pre-filtered versions... Let's say we call it prefilter_vars. We have then the
following situations:
a) prefilter_vars is empty
Everything works as usual
b) prefilter_vars is { "LANG" }
smarty does compile distinct versions for each value of $LANG and stores them,
let's say in different subdirectories ( en/foo.tpl, de/foo.tpl )
c) prefilter_vars is { "LANG", "X" }
Now we can even enhance that scheme to multiple variables! (corresponding to a
two level directory hierarchy...)
What do you think of that? You wouldn't need to write different resource
handlers as we don't touch them...
Don't conform!
IkKampfCaspar75