defnull  committed 5f86c57

docs: Prepared multi-lingual documentation.

  • Participants
  • Parent commits e2cedf2

Comments (0)

Files changed (3)

File docs/_locale/README.txt

+Requirements and Setup
+You need python-sphinx (pip install sphinx) and gettext (for msgmerge and msgfmt).
+A translation file editor (e.g. poedit) helps a lot.
+Translation Workflow
+Run docs/_locale/ before and after editing *.po files to merge new
+sentences and check for errors.
+Do not add *.mo files to the repository, even if your editor creates them.
+We only need the *.po files.
+Add a new language
+Add your language (two-letter code) to '' and run it. A new
+two-letter directory will appear with all the *.po files in it.

File docs/_locale/

+cd "$( cd "$( dirname "$0" )" && pwd )"
+LANGUAGES='de cn'
+echo 'Generating new POT files ...'
+sphinx-build -b gettext -E .. _pot
+echo 'Merging and compiling *.po files ...'
+for LANG in $LANGUAGES; do
+  for POT in _pot/*.pot; do
+    DOC=`basename $POT .pot`
+    echo $LANG/$DOC.po
+    test -d $LANG/LC_MESSAGES || mkdir -p $LANG/LC_MESSAGES
+    test -f $LANG/$DOC.po || cp $POT $LANG/$DOC.po
+    msgmerge --quiet --backup=none -U $LANG/$DOC.po $POT
+    msgfmt $LANG/$DOC.po -o "$LANG/LC_MESSAGES/$"
+  done

File docs/

 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
 language = 'en'
+locale_dirs = ['_locale']
 # There are two options for replacing |today|: either, you set today to some
 # non-false value, then it is used:
 autodoc_member_order = 'bysource'
-locale_dirs = ['./locale']