Sphinx
安装
pip install -U Sphinx
创建项目
sphinx-quickstart
编译成html
sphinx-build -b html sourcedir builddir
或者
make html
国际化
安装sphinx-intl
pip install sphinx-intl
conf.py
里添加配置
locale_dirs = ['locale/'] # path is example but recommended.
gettext_compact = False # optional.
将文档的可翻译消息提取到Pot文件中:
make gettext
设置/更新 locale_dir:
sphinx-intl update -p _build/gettext -l de -l ja
完成后,您获得了包含po文件的以下目录:
./locale/de/LC_MESSAGES/
./locale/ja/LC_MESSAGES/
在以下位置翻译您的po文件 ./locale/<lang>/LC_MESSAGES/.
编译成html
make -e SPHINXOPTS="-D language='de'" html
网友评论