[Dbix-class] Advices needed on creating multilingual application

Matt S Trout dbix-class at trout.me.uk
Sun Sep 23 23:25:04 GMT 2007


On Sun, Sep 23, 2007 at 08:00:06PM +0100, Jonas Alves wrote:
> On 23/09/2007, Matt S Trout <dbix-class at trout.me.uk> wrote:
> >
> > On Fri, Sep 21, 2007 at 07:19:52AM +0300, mbit at ukr.net wrote:
> > > 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:
> >
> > Yes.
> >
> > But like I say, that's not the approach I'd use since you'll bottleneck
> > horribly on the DB that way.
> >
> > Generate out to .po files and stop worrying about abusing SQL.
> 
> 
> Yes, that's good for the text on the templates or for the form validation
> errors.
> But if you have a lot of articles inserted with a CMS that is not the way to
> go.

Sure. But then you're probably going to want a materialized view or something.

Or to generate out a directory tree of article data, which is what most CMSes
seem to do.

Killing your database is not generally a good plan for scaling :)

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list