AW: [SMARTY] Multilangual support for websites

From: Date: Fri, 31 May 2002 11:02:15 +0000
Subject: AW: [SMARTY] Multilangual support for websites
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-4481@lists.php.net to get a copy of this message
i have a config-file for each template. for every language a have a section in each config-file. then i have a language variable as well. let's say $lng and it's assigned to each template. in the templates then i say {config_load file="filename" section=$lng} > 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: > >> [ 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 > >> > > > > -- > > Smarty General Mailing List (http://smarty.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.smarty.general (#4481) next »