Re: [SMARTY] Multilangual support for websites
| From: | Ben Godfrey | Date: | Fri, 31 May 2002 10:45:42 +0000 |
| Subject: | Re: [SMARTY] Multilangual support for websites | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4480@lists.php.net to get a copy of this message | ||
This isn't a best practice suggestion, it's just a random idea, but I think that config files sound like a great solution to localisation. Stick all your data in there and load the right one by assigning a language template variable from the PHP:
$smarty->assign("language_config", "config/$language.cfg");
{config_load file=$language_config}
Ben
On Friday, May 31, 2002, at 11:06 AM, LIMBOURG Arnaud wrote:
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:-- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php[ 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