[Dbix-class] Advices needed on creating multilingual application
mbit at ukr.net
mbit at ukr.net
Fri Sep 21 05:19:52 GMT 2007
Matt S Trout(dbix-class at trout.me.uk)@Wed, Sep 19, 2007 at 06:14:08PM +0100:
> On Wed, Sep 19, 2007 at 11:50:26AM +0300, mbit at ukr.net wrote:
> > Hello.
> >
> > I need an advice on writing multilangual web-application. Question is not
> > about i18n or localization, that's was described here many times and i got it
> > worked pretty easy :) The thing is in organizing database storage.
> >
> > Let's assume an easy application. We have a blog. But there are three versions
> > int three languages: en, de and ru for example. But when we don't have a
> > translation for the en part, we show original part. This way first we add
> > original post in de, and then if we translate that part we add translation. And
> > when a user views en version of the site he sees translated part. Otherwize he
> > sees de version. This way in all three languages we have complete website, just
> > not everything is always translated, but we know what changed and was added in
> > all languages.
>
> Don't hit the database for every string.
>
> Use Catalyst::Plugin::I18N and generate out to string dictionaries / .po files.
>
> Then you can make the DB storage as inefficient as you like :)
Didn't get your humor here ;-)
But please answer a question: can we somehow create relationship where we can
provide args in runtime, so this is possible:
1 SELECT
2 t1.id,
3 COALESCE(t2.lang, t1.lang) AS lang,
4 COALESCE(t2.title, t1.title) AS title,
5 COALESCE(t2.body, t1.body) AS body,
6 FROM
7 entry AS t1
8 LEFT JOIN
9 entry_t AS t2
10 ON
11 t1.id = t2.transof AND t2.lang = 'ru'
12 ORDER BY
13 t1.ctime
14 LIMIT 5
Question is about line #11 and ``AND t2.lang = 'ru'".
Thanx :)
--
vti -- Viacheslav Tikhanovskii
More information about the DBIx-Class
mailing list