[Python开发] sphinx学习
来源:互联网 发布:weka model java code 编辑:程序博客网 时间:2024/05/22 09:46
Sphinx是一个python文档生成器,详见:http://www.sphinx-doc.org/en/stable/
安装Sphinx。
pip install sphinx
配置文档资源
使用Sphinx的向导quickstart
自动生成默认的conf.py
。
sphinx-quickstart
生成
sphinx-build -b html sourcedir builddir
如果在向导时候创建了Makefile
和make.bat
,则可以使用更简单的命令。
make html
国际化
安装sphinx-intl
pip install sphinx-intl
添加配置到conf.py
中
locale_dirs = ['locale/']gettext_compact = False
提取文档翻译信息
sphinx-build -b gettext sourcedir builddir/locale
如果make.bat
中有相应的命令的话也可以用
make gettext
在_build/local/
生成.pot
文件。
安装/更新locale_dir
根据_build/locale
在当前目录生成locale/
文件夹,里面有待翻译的文件。如下语言为zh
,生成locale/zh/LC_MESSAGES/
文件夹,里面有待翻译的po
文件。
sphinx-intl update -p _build/locale -l zh
翻译po
文件
在msgstr
所在行写入上一行msgid
所对应的翻译内容,如
msgid "Hello World!"msgstr "你好,世界!"
生成mo
文件及相应的html
sphinx-build -D language=zh -b html sourcedir builddir/html-zh
在po
文件所在位置生成相应的mo
文件,并在builddir/html-zh/
中生成相应的html。
0 0
- [Python开发] sphinx学习
- sphinx学习
- python Sphinx windows 安装
- python 文档生成器 sphinx
- sphinx-for-python
- Sphinx学习之sphinx的安装篇
- sphinx学习笔记1
- sphinx使用学习笔记
- sphinx万能数据源:python数据源
- Sphinx Introducation: Python Documentation Generator
- CentOS 安装配置python Sphinx
- reStructuredText 入门 Sphinx学习文档
- sphinx
- sphinx
- sphinx
- sphinx
- Sphinx
- Sphinx
- BM算法
- iOS开发中自定义相册功能性能改善
- POJ 3693 Maximum Repetition Substring 后缀数组
- 安卓开发:活动的四种启动模式
- SSH连接服务器出错解决方法,
- [Python开发] sphinx学习
- CentOS安装apache,MysqL,PHP
- leetcode笔记:Game of Life
- 开发jpa应用时异常
- C#文件操作的两种方式
- Codeforces Round #257 (Div. 2) C. Jzzhu and Chocolate (数学)
- VS2015--win32工程配置的一些想法之GdiplusTypes.h(470) : error C3861: 'min': identifier not found
- Android文件下载(实现断点续传)
- PAT习题解:1010. Radix (25)