Storing i18n data in a database using XML

Posted by TigrouMeow on Stack Overflow See other posts from Stack Overflow or by TigrouMeow
Published on 2010-05-31T01:39:06Z Indexed on 2010/05/31 1:42 UTC
Read the original article Hit count: 290

Filed under:
|
|
|
|

Hello,

I may have to store some i18n-ed data in my database using XML if I don't fight back. That's not my choice, but it's in the specifications I have to follow. We would have, by example, something like following in a 'Country' column:

<lang='fr'>Etats-Unis</lang>
<lang='en'>United States</lang>

This would apply to many columns in the database.

I don't think it's a good idea at all. I tend to think that a cell in a database should represent a single piece of data (better for look-up), and that the database should have two dimensions maximum and not 3 or more (one request more would be required per dimension / a dimension here would be equal to the number of XML attributes).

My idea was to have a separate table for all the translations, with columns such as : ID / Language / Translation. However, I should admit that I'm really not sure what is the best way to store data in various languages in a DB...

Thanks for your advices :)

© Stack Overflow or respective owner

Related posts about sql

Related posts about Xml