翻译 Django 数据库值的最佳/推荐方式 [英] The best/recommended way to translate Django database values

查看:13
本文介绍了翻译 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:

  • 为每种语言保存一个数据库column(例如description_endescription_dedescription_fr、...)或
  • 每种语言都有不同的数据库(例如schema_enschema_frschema_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.

这篇关于翻译 Django 数据库值的最佳/推荐方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆