-
1. Re: Localized content in database
kukeltje.ronald.jbpm.org Mar 13, 2010 1:57 PM (in response to flopsi)Why not add a lang column to the entities... would not need to change anything if a new language is added? Or do I miss something?
-
2. Re: Localized content in database
flopsi Mar 13, 2010 5:34 PM (in response to flopsi)Hi Ronald,
first thanx for the response. Of course that would work somehow but i think would cause database and index overhead as every entity (with all property values, which are mostly the same) had to be saved n times, once for every language, isn't it?
I know a way to avoid this would perhaps be to separate the non-localized properties from the localized (putting them in an extra table), but for this to work i had to define new entities and establish some kind of one-to-many relationship between theoriginal
entity and the entity containing the localized properties, right?
Hmmm, also not that stylish...
But maybe i am just a blockhead this time?!?Thanks, best regards
Flo -
3. Re: Localized content in database
v.lukoyanov Mar 13, 2010 5:50 PM (in response to flopsi)I can try the following solution:
Add new entity to represent localized strings with the following fields
localizedText { long id, int lang_id, varchar text, primary key (id, lang_id) }
When you create new multi-lang entity, create new N LocalizedText instances to represent N languages for every multi-lang field. Then you just put those LocalizedText.id instead of actual text.
In order to transparently convert id to text, you can implement custom hibernate interceptor.
The main disadvantage of this approach complicated entity update operation.
----------
Free templates for websites