tork-a / openrtm_tutorial

Compilation of existing OpenRTM tutorial contents, with some extra features that allow you to run all tutorials via InternetExplorer. Project funded by New Energy and Industrial Technology Development Organization (NEDO).
5 stars 8 forks source link

Create a script to semi-automate translation update #20

Open 130s opened 10 years ago

130s commented 10 years ago

Initially the tutorial was written in Japanese then English rendition was added (commits ending at #14) by utilizing sphinx-intl that involves complicated manual process. It's nice to have an updater script that can handle at least 2 following situations:

Prerequisite: sphinx-common is installed. Folder structure of sphinx is already prepared (that is already added in https://github.com/tork-a/openrtm_tutorial/commit/70a62770e55ee2461daf0ce3d8204ee65872322d)

Assumption: It's ok to run this script on linux, not on Windows

Case-1. Only message catalogs (.po) files are updated.

In the case where only translation was added to .po files and no original source file (.rst) isn't changed,

$ cd %OPENRTM_TUTORIAL%/doc            (where `conf.py` exists)
$ sphinx-intl build
$ make -e SPHINXOPTS="-D language='ja'" html   (not ideal but making `en` directly ignores the change)
$ make -e SPHINXOPTS="-D language='en'" html
$ cp _build/html/* locale/en   (Copy translation `.html` files to manually created folder `locale`)

This isn't clear yet because sometimes the steps above don't generate the updated content so I had to start over the steps mentioned in Case-2.

Case-2. Original source files (.rst) are updated.

In addition to the steps mentioned above, most of the steps in the official doc are needed like:

$ make gettext
$ sphinx-intl update -p _build/locale -l en -l ja
:   (same as steps in `Case-1`)
k-okada commented 10 years ago

GOOD!!!

On Wed, Apr 9, 2014 at 2:53 PM, Isaac Isao Saito notifications@github.comwrote:

Initially the tutorial was written in Japanese then English rendition was added (commits ending at #14https://github.com/tork-a/openrtm_tutorial/issues/14) by utilizing sphinx-intl http://sphinx-doc.org/latest/intl.html that involves complicated manual process. It's nice to have an updater script (that runs on linux) that can handle at least 2 following situations:

Prerequisite: sphinx-common is installed. Folder structure of sphinx is already prepared (that is laready added in 70a6277https://github.com/tork-a/openrtm_tutorial/commit/70a62770e55ee2461daf0ce3d8204ee65872322d )

Case-1. Only message catalogs (.po) files modified.

In the case where only translation was added to .po files and no original source file (.rst) isn't changed,

$ cd %USB_HOME%/doc (where conf.py exists) $ sphinx-intl build $ make -e SPHINXOPTS="-D language='ja'" html (not ideal but making en directly ignores the change) $ make -e SPHINXOPTS="-D language='en'" html $ cp _build/html/* locale/en (Copy translation .html files to manually created folder locale)

This isn't clear yet because sometimes the steps above don't yet generate the updated content so I had to do all including the steps mentioned in Case-2.

Case-2. Original source files (.rst) modified.

In addition to the steps mentioned above, most of the steps in the official doc http://sphinx-doc.org/latest/intl.html#quick-guide are needed like:

$ make gettext $ sphinx-intl update -p _build/locale -l de -l ja : (same as steps in Case-1)

— Reply to this email directly or view it on GitHubhttps://github.com/tork-a/openrtm_tutorial/issues/20 .