开发者

Multilingual website with not relational database

Can anyone help with advice how to organize not relational database for multilingual site? Here it is some questions about this stuff but with MySQL, etc. "multilanguage" is not only static (we can do this with framework), but with dynamic content too. And actually we don't know about how many languages user wish to create content: can create "Name" for object and translate it on as many languages as he wants.

Our team use Java Spring Framework on GAE with Objectify. But I thin开发者_如何学Pythonk this is not important - what tools we're using.

Or maybe nosql databases is not actually right tool for tasks like this.

p.s. sorry for bad english


If I didn't understand wrong, i think this is the best way I found for Multi-lang DB (I use MySQL, but it would be the same story):

  • First of all, you should avoid to store long strings on main table (such as name, description). You can store them in different tables. Your table will be faster.

  • You can use translation table for all your objects (such as product, order, shipping, etc.)

Translation table:

translation_id    obj_id     lang_code    field        translation
------------------------------------------------------------------------
      1              2          EN        name      Million Dollar Baby
      2              2          TR        name      Milyonluk Bebek

obj_id references product_id actually and can be related with product_id. I prefer obj_id, because it's easy for me to control all translation tables without remembering order_id, product_id etc.

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜