最近发现 transifex
是一个很棒的合作翻译平台. 很多大型的项目都是在这里做的翻译. 其中也包括了 django. 但是目前 参与翻译 django 文档的貌似并不积极. 因此. 我 folk 了一份, 模仿了官方的做法. 新建了一个项目. 包括对应的 github. 做了些小的脚本.
可以及时的更新 大家的劳动成果.
简单的说:
如果想阅读半成品的翻译结果 请访问:
https://djangodoc-zh_cn.readthedocs.org/en/latest/
如果想参与进来一起翻译 请访问:
https://www.transifex.com/projects/p/djangodoc-zh_cn/
如果更新了内容, 请发 issue 我会跑下脚本 更新 readthedocs 上的内容.
下面的内容暂时忽略把. 我写的一些配置这些东西的笔记.
-
django django source code use latest stable version tags/1.5.1 This is where the sphinx content comes from. make sure it is using the same version with the django-docs-translations.
-
django-docs-translations django translations project use the branch stable/1.5.x This is where the pot files comes from. make sure it is on the right branch.
- try to make these steps into a python script.
-
setup the django and django-docs-translations to the right version.
$ git submodules update --init --rebase $ cd django $ git checkout 1.5.1 $ cd ../ $ cd django-docs-translations $ git checkout stable/1.5.x $ cd ../
-
copy all the pot files from django-docs-translations to pots folder.
$ cp django-docs-translations/pots/* pots/ $ cp pots/* translations/zh_CN/
-
change the filenames in translateions/zh_CN from *.pot to *.po
$ cd translations/zh_CN $ for filename, ext in $ !mv filename+ext filename+'.po'
-
translate the po files.
edit the po files to make strings translated.
-
copy the docs from django project.
$ cp -a django/docs .
-
make mo files.
$ for filename, ext in translations/zh_CN/*.po $ msgfmt "filename + ext" -o "translated/zh_CN/LC_MESSAGES/filename + .mo"
-
update config file for sphinx.
open docs/conf.py:find language = None update lines: language = "zh_CN" locale_dirs = ['../translated/']
-
make html using sphinx
$ cd docs $ make html
-
the final docs will be in folder
~/Djangodoc-zh_CN/docs/_build/html/index.html
-
get all the translations from online. this updates the
translations/zh_CN/LC_MESSAGES/*.po
$ tx pull -a
-
you can also edit the po files from local machine. then upload them to online.
$ tx push -t
-
docs/
contains django v1.5.1 docs content. make that using translations from tx.$ ./update.py