How to use multilanguage database schema with ORM?
Good day!
I'm searching for the best way to implement multilanguage database schema, the approach I use is the same as here: What are best practices for multi-language database design? (one table with language neutral data and one for all translation). It seems to be good and clean and doesn't limit number of possible languages.
But I want to use a simple ORM (like LINQ in C#, Outlet for PHP etc) where each table is mapped to entity class. This can work, but queries became more complex.
May be there are some special techniques to use such DB shema with ORM? Or I can benefit from more complex ORMs which support more complex mappings?
Thanks in advance!
Using only one table for all translations may quickly lead to severe performance and complexity issues for any operation (select/insert/update/delete) ; just try it to understand what I mean.
I would then go for the following method (two tables per "translatable" object), which seems a good balance between performance, complexity, and maintenance issues.
product
- id (PK)
- number1
- number2
- date1
- date2
...
product_i18n
- id (PK)
- product_id (FK)
- language_id (FK)
- string1
- string2
...
language
- id (PK)
- name
Check how it's done with Propel ORM (PHP) : http://propelorm.org/blog/2011/01/11/propel-gets-i18n-behavior-and-why-it-matters.html
HTH
链接地址: http://www.djcxy.com/p/37450.html上一篇: 多种最佳实践是什么?
下一篇: 如何在ORM中使用多语言数据库模式?