rdoc/rdoc — pull request #254 by kou (2013-09-25 15:18:38+00:00)
Title: Add i18n feature

Sorry for my late work. :<

I implemented i18n feature for RDoc based on gettext technology. .po file is used for managing translated messages. See also: [GNU gettext's documentation](http://www.gnu.org/software/gettext/manual/gettext.html)

This pull request adds the following options:

* --locale
* --locale-data-dir

And it also adds `pot` formatter.

This pull request doesn't include .po for Japanese. If this pull request is merged, I will send it as a new pull request.

Here is a translator work flow:

## Create .pot

You create .pot file by pot formatter:

% rdoc --format pot

It generates doc/rdoc.pot.

## Create .po

You create .po file from doc/rdoc.pot. This operation is needed only the first time.
This work flow assumes that you are a translator for Japanese.

You create locale/ja/rdoc.po from doc/rdoc.pot. You can use `msginit` provided by GNU gettext or
`rmsginit` provided by gettext gem. This work flow uses gettext gem because it is more portable
than GNU gettext for Rubyists. Gettext gem is implemented by pure Ruby.

% gem install gettext
% mkdir -p locale/ja
% rmsginit --input doc/rdoc.pot --output locale/ja/rdoc.po --locale ja

## Translate messages in .po

You translate messages in .po by a PO file editor. I'm using po-mode.el on Emacs.
There are some GUI tools such as [GTranslator](http://en.wikipedia.org/wiki/Gtranslator).
There are some Web services such as [POEditor](https://poeditor.com/) and [Tansifex](https://www.transifex.com/).
You can edit by your favorite text editor because .po is a text file.

## Generate localized documentation

You can generate localized documentation with locale/ja/rdoc.po:

% rdoc --locale ja

You can find documentation in Japanese in doc/. Yay!

## Update translation

You need to update translation when your application is added or modified messages.

You can update .po by the following command lines:

% rdoc --format pot
% rmsgmerge --update locale/ja/rdoc.po doc/rdoc.pot

You edit locale/ja/rdoc.po to translate new messages.