Django的I18N与第三方应用程序 [英] Django's I18N with third-party apps

查看:112
本文介绍了Django的I18N与第三方应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Django项目,它使用 django-tagging ,应该用德语运行。所以我调查了这些来源,发现 django-tagging 确实使用了 gettext_lazy ,因此完全可以翻译。但是,在包中没有可用的翻译。所以我想我必须有办法从我的项目中翻译。



换句话说,我希望 ./ manage.py makemessages -a 以包含 django-tagging 中的非翻译字符串,但显然我错了。



那么,如何正确地管理这种情况?将翻译 django-tagging 在上游存储库中按预期工作?

解决方案

您可以在django-tagging目录中创建gettext消息,并向项目负责人贡献翻译:

  django-admin.py makemessages -l de 

如果要在项目目录中创建消息目录,应该安装或符号链接应用程序-S选项的makemessages)在您的项目目录。然后使用manage.py makemessages命令如上。



如果您想查看有关翻译第三方应用程序的更多详细信息,请查看:



http://source.mihelac.org/2010/07/31/处理-i18n-in-django-projects /


I have a Django project which uses django-tagging and is supposed to run in German. So I looked into the sources and found that django-tagging does indeed use gettext_lazy and is thus completely translatable. However, there are no translations available in the package. So I assume there must be a way for me to translate it from within my project.

In other words, I expect ./manage.py makemessages -a to include untranslated strings from django-tagging, but apparently I'm wrong to expect that.

So, how do I manage this situation properly? Will translating django-tagging in the upstream repository work as expected?

解决方案

You can create gettext messages in django-tagging directory and contribute translations to project leader:

django-admin.py makemessages -l de

If you want to create message catalog in your project directory, you should install or symlink app (check -S option of makemessages) in your project directory. Then use manage.py makemessages command as above.

If you want to see more details about translating 3rd part apps, please check:

http://source.mihelac.org/2010/07/31/handling-i18n-in-django-projects/

这篇关于Django的I18N与第三方应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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