如何本地化Django应用程序的内容 [英] How to localize Content of a Django application
问题描述
用户可以将产品保存在数据库中,并提供名称和描述,但由于整个站点都应进行本地化,因此我必须提供一种将用户名和描述转换为用户的方法。
在django中有自然的做法吗?或者我必须意识到它是应用程序的一部分(通过在数据模型中表示翻译)
谢谢Janosch
我建议您查看 django-多语言。它是一个第三方应用程序,可以让您定义模型中的翻译字段。
当然,您仍然必须输入实际的翻译,但它们是透明地存储在数据库(而不是静态PO文件),这是我相信你在问的。
Hey, i am currently working on a django app for my studies, and came to the point of l18n. Localizing the site itself was very easy, but now i have to allow users, to translate the dynamic content of the application. Users can save "products" in the database and give them names and descriptions, but since the whole site should be localized, i must provide a way of translating theses names and descriptions to the users.
Is there a natural way in django to do this? Or do i have to realize it as part of the application (by representing the translations in the datamodel)
Thanks, Janosch
I would suggest checking out django-multilingual. It is a third party app that lets you define translation fields on your models.
Of course, you still have to type in the actual translations, but they are stored transparently in the database (as opposed to in static PO files), which is what I believe you are asking about.
这篇关于如何本地化Django应用程序的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!