RE: [SMARTY] using different languages in my Templates

From: Date: Fri, 20 Dec 2002 12:57:17 +0000
Subject: RE: [SMARTY] using different languages in my Templates
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6905@lists.php.net to get a copy of this message
Hi Andreas, I had a similar problem not so long ago and decided to go for a custom plugin like this: {translate key="key_to_translate"} The translate plugin used the specified key to lookup a translation in the database according to the currently set language (which can be stored in the GET, a cookie, or in the session or whatever). You could also work the other way around and translate everything once you've fetched your template. Then you do in your php code something like: $smarty->assign_by_ref('mainContents', translate(smarty->fetch('mytemplate.html'))); In this case the translate function would do regular expressions on the code and search for example for everything that's not inside a javascript, style, etc... Basically, it would try to create a plaintext version of that document, translate every part that's found both in the plaintext file and in the wordlist/paragraphlist and afterwards put all the formatting tags and javascripts etc back again. This way you can translate any HTML document after it has been parsed by smarty. I like the first solution better :-) Yuri Weseman -----Original Message----- From: Andreas Korthaus [mailto:akorthaus@web.de] Sent: Friday, December 20, 2002 1:43 PM To: smarty-general@lists.php.net Subject: [SMARTY] using different languages in my Templates Hallo! I'm thinking of using different languages (english, german, french and spanish) in my templates, but I have no (good) idea how to do this. Should I use one template vor each language, or should I work with variables in my templates, for example {$title}, and decide in my php-Script which language should be used? What would you recommend here? Kind regards, Andreas ____________________________________________________________________________ __ PREMIERE: Der Countdown laeuft! 3 Monate gratis + d-box 1 ab 1 Euro nur noch wenige Tage zu haben! http://premiere.web.de/?mc=999927&lp=2 -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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