Hello! Two weeks have passed since I proposed the Establishment of Chinese Language Manual
Thanks all for your support and suggestions, I finally found a way to synchronously generate multilingual manuals without changing the structure of the original manuals. We might be able to take advantage of Sphinx’s nationalization support, and I’ve been testing Chinese document generation on a copy of the TVM project, and it works fine.
Here gives the example:
First I want to present the schematic, which is from official website of Sphinx.
sorry, I don’t have privileges to give more than one image in a topic, so i will give it in comments section
In the example above, I have translated only one file (*.po), which reads as follows:
# ... #: ../../_staging/index.rst:21 msgid "" "TVM is an open deep learning compiler stack for CPUs, GPUs, and " "specialized accelerators. It aims to close the gap between the " "productivity-focused deep learning frameworks, and the performance- or " "efficiency-oriented hardware backends." msgstr "" "Apache TVM是用于深度学习系统的编译器堆栈。它旨在缩小以生产力为中心的深度学习框架与以性能和效率为中心的硬件后端之间的差距。TVM与深度学习框架配合使用，为不同的后端提供端到端编译。" #: ../../_staging/index.rst:25 msgid "Get Started" msgstr "开始吧！" #: ../../_staging/index.rst:27 msgid "Follow the :doc:`instructions <install/index>` to install TVM." msgstr "依据 :doc:`介绍 <install/index>` 来安装TVM" # ... # msgid gives the source document, which is generate automatically # msgstr gives the aim document, we work here!
- Finally, I gives the change to the source code and TVM website-code generate process:
- add code to
# I put them to line 54-55. locale_dirs = ['locale/'] gettext_compact = False
- generate gettext
cd docs/ make -j20 gettext # you will find a fold named "locale" generated in docs/_build/
cd docs/_staging/ sphinx-intl update -p _build/locale/ -l zh_CN -l en # It will set up internationalization support for English and Chinese # then docs/_staging/locale will be generated. For the Chinese manual, we only need to translate docs/_staging/locale/zh_CN/LC_MESSAGES/*.po # Of course, when run "make clean", the locale should not be delete.
- generate static-website-code for multi-language (Chinese for example):
make -e SPHINXOPTS="-D language='zh_CN'" html # the fold "html", written in Chinese, will be generated in docs/_build/. We can deploy it normally
What’s more, co-translation can be performed using
transifex, which provides a good division of work between translators and reviewers. I only test the service from
transifex.com, but it comes at a high cost. It seems that
transifex is an open-source-software? Can we deploy it and work on it?
We look forward to the preparation of the Chinese handbook as soon as possible, and look forward to the official response and your participation.
(We have already contacted some people working on the Chinese manual, if you are interested, please join us or guide us. Group entry will be given in the comments section)