Re: [SMARTY-GENERAL] On multilanguage documents
| From: | Peter Bowyer | Date: | Mon, 08 Apr 2002 07:40:32 +0000 |
| Subject: | Re: [SMARTY-GENERAL] On multilanguage documents | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3554@lists.php.net to get a copy of this message | ||
At 02:56 AM 4/8/02 +0200, Michal Prinke wrote:
How do you handle generating documents in various languages? I do it like this (please correct me if there is a better/cleaner way):Approaches to translation: 1. Separate templates for different languages. Has the advantage of allowing you to naturalise images, make allowances for a more verbose language etc... but of course is duplication of effort for many projects where the templates could be the same. Nevertheless, I believe this approach will always be needed for some pages on the site. 2. Translation into a template using a prefilter. This means the translation is only done once before the templates are compiled, whereas I believe that using config files is processed more often. May be wrong though! For sample code showing it using a prefilter have a look at <http://www.mapledesign.co.uk/coding/smarty_i18n.php>. I feel that a mix of the above would be the best way to do it - you'd have to seta var $_LANG and use that in the call to language specific templates (is there a fall-back method for catching the template if it doesn't exist in that directory and substituting a default version?) and then string substitution for small bits of text. Peter. -- Maple Design - quality web design and programming http://www.mapledesign.co.uk