ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <lmead...@apache.org>
Subject Re: I18N best practices with iBatis
Date Thu, 05 Jul 2007 14:42:04 GMT
Is this a web app or a desktop app?

Larry


On 7/4/07, Collin Peters <cadiolis@gmail.com> wrote:
> On 6/29/07, Larry Meadors <lmeadors@apache.org> wrote:
> > So you have a field for each locale?
>
> Yes, a column for each locale in the i18n table
>
> > I'd think it would be easier to if that were a compound key instead:
> >
> > SELECT a.activity_id, i.name as name
> > FROM  activities a
> > JOIN  i18n i ON (a.name_i18n_id = i.i18n_id and i.i18n_locale = #locale#)
> >
> > But.. I guess you'd still have to pass it to each query...
>
> Yup, same question for iBatis
>
> > How about this - if you don't have a ton of locales to support, you
> > could do this:
> >
> > SELECT a.activity_id, i.${locale} as name
> > FROM  activities a
> > JOIN  i18n i ON (a.name_i18n_id = i.i18n_id)
> >
> > Then pass in the locale when you create the sqlmap client - each
> > locale would have it's own sql map client that you could put in a Map,
> > then put on the thread (use a ThreadLocale) and get from there when
> > needed. That could be a pretty clean solution if done well.
>
> Can you expand on this idea a bit?  I'm not sure what you mean with
> the Thread idea.  In the end all I want is a way to abstract having to
> send the locale as a variable to *every* single call in my iBatis
> code.
>

Mime
View raw message