Skip to content

Instantly share code, notes, and snippets.

@knzm
Created December 14, 2012 16:17
Show Gist options
  • Select an option

  • Save knzm/4286610 to your computer and use it in GitHub Desktop.

Select an option

Save knzm/4286610 to your computer and use it in GitHub Desktop.

How to develop Sphinx

i18n

  1. 翻訳可能とするために文字列を _ または l_ で囲む
from sphinx.locale import _, l_

_("message")
  1. pot ファイルと po ファイルを更新
$ easy_install babel
$ python setup.py extract_messages
$ python setup.py update_catalog -D sphinx -l ja
  1. sphinx/locale/ja/LC_MESSAGES/sphinx.po を編集する
  2. po ファイルを mo ファイルにコンパイルする
$ python setup.py compile_catalog -D sphinx -l ja

test

  1. tests/root/ 以下にテスト用のプロジェクトがあるので、ファイルを追加する
  2. テストを実行する
$ easy_install nose
$ python tests/run.py -v
  1. 特定のテストのみ実行する
$ nosetests tests/test_intl.py -v -s --pdb --pdb-failure
  1. テスト用の po ファイルの作り方
$ cd tests/root
$ sphinx-build -b gettext -d _build/doctrees -D gettext_compact=0 . _build/gettext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment