使 Django 本地化

Django 的很多部分,比如后台站点和认证错误提示都是国际化的。这意味着它们根据使用者的语言展示不同的信息。为此,Django 使用了和 Django 应用相同的国际化和本地化基础设施,在 i18n documentation 中介绍。

翻译

翻译内容由全球的 Django 用户提供。协调工作由 Transifex 负责。

如果你发现了一个错误翻译,或是想探讨某部分的翻译,前往 Django project page。如果你想帮助翻译,或是添加一个未被收录的语言,以下是如何做的方式:

  • 加入 Django i18n mailing list 并介绍你自己。

  • 确保你已经阅读了 Specialties of Django translation 的注意点。

  • Transifex 注册并访问 Django project page

  • Django project page,选择你期望翻译的语言, ——如果该语言不存在——点击“Request language”链接,选择合适的语言,请求创建一个新的语言团队。

  • Then, click the “Join this Team” button to become a member of this team. Every team has at least one coordinator who is responsible to review your membership request. You can also contact the team coordinator to clarify procedural problems and handle the actual translation process.

  • 一旦你成为团队的一员,你就可以在团队页选择你要翻译的文档。例如,“核心”资源是指包含所有非 contrib 翻译的翻译目录。 每个 contrib 应用程序也有一个资源(前缀为“contrib”)。

    注解

    更多关于如何使用 Transifex 的信息,阅读 Transifex User Guide

Translations from Transifex are only integrated into the Django repository at the time of a new feature release. We try to update them a second time during one of the following patch releases, but that depends on the translation manager’s availability. So don’t miss the string freeze period (between the release candidate and the feature release) to take the opportunity to complete and fix the translations for your language!

格式

你页可以阅读 conf/locale/<locale>/formats.py。该文件介绍了基于你所在地的日期,时间和数字的格式。参考 本地格式化 获得更多信息。

格式文件并不由 Transifex 管理。要修改它们的话,你必须对比当前 Django 代码 创建一个补丁 ,就像修改其它代码一样:

  • 针对当前的 Git 主分支创建一个 diff。
  • 在 Django 的工单系统创建一个工单,设置其 Component 字段为 Translations,并附上补丁。

文档

还有翻译文档的机会,虽然这是一项浩大的工程(事先提醒!)。同样,我们使用 Transifex tool。只要 docs/intro/* 部分的全部文档被翻译,你就能在 https://docs.djangoproject.com/<language_code>/ 见到该语言的版本。中文翻译团队官网:https://www.djangodocs.com/

Once translations are published, updated versions from Transifex will be irregularly ported to the django/django-docs-translations repository and to the documentation website. Only translations for the latest stable Django release are updated.