RE: [SMARTY] Multilangual support for websites
| From: | LIMBOURG Arnaud | Date: | Fri, 31 May 2002 10:06:43 +0000 |
| Subject: | RE: [SMARTY] Multilangual support for websites | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-4479@lists.php.net to get a copy of this message | ||
One way is to have templates for each language and structure them like:
mytemplatesdir/
en/
main.tpl
fr/
main.tpl
es/
main.tpl
You define a var on script execution like $mylang
and do
$smarty->display($mylang . "/main.tpl);
Arnaud.
> Are there any best practices or code-examples on supporting
> multilangual templates?
>
> The kind of solution I'm working on at the moment is as follows:
> [ show_users.tpl ]
> include [ app_header.tpl ]
> include [ app_footer.tpl ]
> Every tpl contains certain language-specific elements. However,
> I don't like to create a tpl for every language (and any browser).
>
> Instead I created a Smarty-function that retrieves content for the
> language elements in the requested language. This function uses
> tpl-specific files for caching, which are exported managed from a
> central database. This database is managed by the client using
> a webfrontend.
>
> In this way
> * templates are not language-specific, just define layout and
> interaction
> * language elements are bind to a specific (included) template
>
> If anyone is busy working on the same topic and like to exchange
> thoughts, feel free to toss your ideas this way =)
>
> Grtz!
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>