最好/推荐的方式来翻译Django数据库值 [英] The best/recommended way to translate Django database values
本文介绍了最好/推荐的方式来翻译Django数据库值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在国际化我的Django应用程序时,我试图找出最好的方法来翻译实际的数据库值(文本字符串,而不是日期格式或任何复杂的东西)。我可以想出的最合理的方法是:
I'm trying to figure out the best way to translate actual database values (textual strings, not date formats or anything complicated) when internationalizing my Django application. The most logical ways I could come up with were to either:
- 为每种语言保存数据库列例如
description_en
,description_de
,description_fr
,...) (schema_en
,schema_fr),或
- 有不同的数据库 ,
schema_de
,...)。
- hold a database column for every language (e.g.
description_en
,description_de
,description_fr
, ...) or - have a different database for every language (e.g.
schema_en
,schema_fr
,schema_de
, ...).
这些是最好的选择,还是有其他我缺少?感谢。
Are these the best options, or is there something else I'm missing? Thanks.
推荐答案
我正在阅读我的django扩展,发现 django-modeltranslation 插件。它似乎做的完全是你想要它做的。如果没有,请留下评论,我会删除此答案:)
I was reading up on my django extensions, and found the django-modeltranslation plugin. It seems to do exactly what you want it to do. If not, leave a comment and I'll delete this answer :)
这篇关于最好/推荐的方式来翻译Django数据库值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文