Re: [SMARTY] Smarty and I18N

From: Date: Thu, 17 Oct 2002 06:50:51 +0000
Subject: Re: [SMARTY] Smarty and I18N
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6183@lists.php.net to get a copy of this message
Hi! On Don, 17 Okt 2002 Thomas Lamy wrote: > Hi, > > I'm using smarty for 3 weeks now, and have only an idea of how I would > create a site with internationalisation. > I'd like to have different levels of i18n: words/phrases (like table > headings or input labels), and text blocks (about more than 1 sentence worth > of text). > I have a similar project (single language) up and running for 2 years, and > get about 200 SQL queries/sec peak, so adding addition load by using a > (relationsl) database is not really an option. > > I thought of implementing the words/phrases thing with simple PHP arrays, > and text blocks using some smart include() function, which either includes > the "right" template (say "login_en.tpl"), and, if that file doesn't > exist, > fall back to include a generic template (eg "login.tpl"). > > I'm not really sure if my approach is really The Right Thing (tm), and how > to do that with smarty (especially auto-including language templates with > fallback), by not breaking caching. If I understand you correctly, you have several templates with the same design? (one for each language?) We wanted to avoid this and wrote us a localize plugin, that is supposed to do the translation later. So we use {localize text="test"} in our templates and have only 1 template for all languages. The translation stuff is still missing (we only need one language to start the site), but could be done via SHMs as an example? All the tags use a Localizer class instance for the translation, so it's only 1 method to add later. Ciao, Andreas

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