Got the first proposed solution from Neal Sanche. Seems it could 
work very well. The idea is outlined in the emails we had below. 
all comments, suggestions welcome.

cheers,
Brian


----- Original Message ----- 
From: "Neal Sanche" <[EMAIL PROTECTED]>
To: "Brian McSweeney" <[EMAIL PROTECTED]>
Sent: Monday, March 24, 2003 3:17 PM
Subject: Re: [JBoss-user] OT: Data Internationalisation Best Practice


> I don't mind, please, I don't feel there's anything really proprietary 
> in there. The trick is to ensure that the many-to-many relation is 
> unidirectional. That way you can have a whole bunch of things use the 
> Replacement EJB and you don't have to keep modifying the replacement 
> EJB to support yet another relation.
> 
> -Neal
> 
> On Monday 24 March 2003 10:07 am, you wrote:
> > completely clear and very neat :-)
> > Do you mind if I forward this to JBoss-users and xpetstore?
> > thanks again,
> > Brian
> >
> >
> > ----- Original Message -----
> > From: "Neal Sanche" <[EMAIL PROTECTED]>
> > To: "Brian McSweeney" <[EMAIL PROTECTED]>
> > Sent: Monday, March 24, 2003 2:43 PM
> > Subject: Re: [JBoss-user] OT: Data Internationalisation Best
> > Practice
> >
> > > Actually, Brian,
> > >
> > > No, you don't tend to have the same problem. The database
> > > structure doesn't change, you simply add another record for the
> > > replacement in the new language. Consider an EJB called
> > > Replacement with fields 'text' and 'locale' and pk 'id'. In your
> > > EJB you would establish a field called 'description' to have a
> > > many-to-many with relation-table to the Replacement EJB.
> > >
> > > Now you'd be able to write code something like:
> > >
> > >   ReplacementLocal r1 = replacementHome.create("cat","en");
> > >   ReplacementLocal r2 = replacementHome.create("char","fr");
> > >
> > >   myEJB.getDescription().add(r1);
> > >   myEJB.getDescription().add(r2);
> > >
> > > Now you'd have to do some lookups something like:
> > >
> > >   String description =
> > > getLocaleString(myEJB.getDescription(),"en");
> > >
> > >   public String getLocalString(Collection replacements, String
> > > locale) {
> > >     Iterator i = replacements.iterator();
> > >     while(i.hasNext()) {
> > >         ReplacementLocal r = (ReplacementLocal)i.next();
> > >         if (r.getLocale().equals(locale)) {
> > > return r.getText();
> > >         }
> > >     }
> > > }
> > >
> > > But really, all you need to do is make the CMR associations. No
> > > database schema changes to support new languages. Just new
> > > database records.
> > >
> > > Hope this clarifies.
> > >
> > > -Neal
> > >
> > > On Monday 24 March 2003 09:25 am, you wrote:
> > > > Interesting Neal,
> > > > but don't you get stuck with the same disadvantage that I
> > > > outlined in my first strategy ie, if you want to support a new
> > > > language don't you have to redeploy the database because it's
> > > > structure has changed?
> > > >
> > > > Also, do you mind if I forward your response to the list to
> > > > keep it aware of the replies. I'll put a note in that if anyone
> > > > wants me to take it off the list I will.
> > > >
> > > > Brian
> > > >
> > > > ----- Original Message -----
> > > > From: "Neal Sanche" <[EMAIL PROTECTED]>
> > > > To: "Brian McSweeney" <[EMAIL PROTECTED]>
> > > > Sent: Monday, March 24, 2003 2:18 PM
> > > > Subject: Re: [JBoss-user] OT: Data Internationalisation Best
> > > > Practice
> > > >
> > > > > On Monday 24 March 2003 08:30 am, Brian McSweeney wrote:
> > > > > > Anway, this seems to highlight the difficulty of
> > > > > > internationalising data vs. just display labels. If anyone
> > > > > > has any suggestions or design patterns we'd love to hear
> > > > > > about them and again sorry that this is off JBoss topic.
> > > > >
> > > > > I am not replying to the mailing list, but thought I'd send
> > > > > some thoughts I've recently gone through on this matter. What
> > > > > I've been working on for a client seems to solve this problem
> > > > > nicely. The idea is to use a CMR relation pointing to a text
> > > > > replacement table, which in turn has a one to many relation
> > > > > with a TEXT table.
> > > > >
> > > > > Another nice option would also be to create a many to many
> > > > > CMR to the replacements table. So, in your case where you
> > > > > want to internationalize the 'description' of something, the
> > > > > 'description' field would become a CMR accessor for a
> > > > > many-to-many unidirectional relation specifying a set of
> > > > > replacements. One for each locale you want to support.
> > > > >
> > > > > The downside of this methodology is you would have to search
> > > > > through the CMR collection of replacement texts to find the
> > > > > string for the current locale. But I wouldn't expect this to
> > > > > really take very long if you're only supporting a few
> > > > > languages.
> > > > >
> > > > > If you have any other good suggestions, keep me in the loop.
> > > > >
> > > > > Thanks.
> > > > >
> > > > > -Neal
> 



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to