internationalization - Design pattern for translatable Hibernate models -
I have a Hibernate model (simplified) that looks like this:
public class coverage { Private long id; Private string coverage text; Private Boolean coverage PrresetTo = true; Private OnNewPolicy onNewPolicy = OnNewPolicy.SHOW; }
I need to voluntarily translate (end-user) in many languages, but using the same ID, such as I request a policy I can do (in which the lines have been added) either in English or German, and the relevant version of the received text is obtained GetCoverageText (). Other fields in the database are not translatable, they are translated using resource files, so many versions of the object in DB are not desirable.
My temporary plan is to create a JSON clob field, and store all the values in it (["lang": "en", "value", "...."}], [{" Lang ":" de "...}]), set language as a manipulate JSON using a transient field, and get / set methods, but it does not really experience a best practice is. Alternatively, to be a second table with line-id, language and string, but in my data-model it is likely to be much less than having more SQL-Wi data.
Any suggestions?
Send all the options down to the UI will not be my first choice.
In one way verbatim must be stored in a table. To know which language you were working with, a column of one language in the coverage table will be the foreign key. The price will be loaded into the object and you will be done.
The downside is that a local change would require a round trip on server, database and back.
Spring completes it with local-based views, you may also try.
Comments
Post a Comment