Django 中的内容翻译,兼容 South
我正在寻找一种在 Django 中具有可翻译数据库字段的解决方案,并且该解决方案需要与 South 兼容。
我已经找到了 django-transmeta 和 transdb。只有后者似乎与南方兼容,但我对此不确定。另外,transdb 值在数据库中看起来不太好(这是客户真正关心的)。
有人使用过这样的组合吗?我并不特别关注 South,但这似乎是 Django 中模式迁移的方法。
I'm looking for a solution to have translatable database fields in Django, and the solution needs to be compatible with South.
I already found django-transmeta and transdb. Only the latter seems to be compatible with South, but I'm not sure about that. Also, transdb values don't look nice in the database (something the customer actually cares about).
Has anybody worked with such a combination? I'm not particaluary focussed on South, but it seems to be the way to go for schema migration in Django.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为这两个应用程序使用自定义字段,而 South 对此有所抱怨。您可以在此处了解如何为这些自定义字段启用南:http://south.aeracode.org /docs/customfields.html。
两个相关链接:
I suppose that tho two apps use custom fields and South complains about that. Here you can read about how to enable south for those custom fields: http://south.aeracode.org/docs/customfields.html.
Two relevant links:
因为我们确实知道语言的数量永远不会改变,所以我们转而为每种语言提供字段以及自动读取当前语言的正确字段的简单机制。我们的实现是这样使用的:
Question().text
然后根据当前语言自动返回正确的字段,并回退到默认语言。它背后的实现应该是不言自明的:
Because we did know that the number of languages will never change, we switched to having fields for each language and a simple mechanism for automatically reading the correct field for the current language. Our implementation is used like this:
Question().text
then automatically returns the correct field, based on the current language with a fallback to the default language.The implementation behind it should be pretty much self-explaining: