Re: [SMARTY] Smarty and I18N
| From: | Thomas Lamy | Date: | Thu, 17 Oct 2002 08:56:06 +0000 |
| Subject: | Re: [SMARTY] Smarty and I18N | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-6184@lists.php.net to get a copy of this message | ||
Andreas Rueckert [mailto:a_rueckert@gmx.net] wrote:
>
> 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?
No, the idea is to have 1 design template, which dynamically includes
localized text blocks.
This is to avoid the large memory footprint when using arrays for
localization.
> (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?
???
Do you think of using shared memory (shm_get()) for the translation table?
Neat idea, I was playing around with (local) low footprint databases, like
dbm or dbf, on the nodes.
> All the tags use a
> Localizer class instance for the translation, so it's only 1
> method to add
> later.
>
Another clarification: I'm working on release 2 for this project. Release 1
is online for 2 years, is not multilingual. In peak hours we have 150
parallel (user) sessions, generating 50 http requests/sec and 150-200 SQL
queries/sec. Scalability is a major issue, as with revision 2 (and i18n) we
expect about 1000 user sessions (peak). We currently run on a 2 node LVS
cluster (doing only http/php, with php acellerator), and 2 mysql servers
running active/active replication, planning to add 1 or 2 more LVS cluster
nodes.
Some interesting ideas are coming from this thread...
Thank you all. When I have made some design decision and did some coding as
well as load testing, I'll publish the code (perhaps as PEAR module).
Thomas