Class: RDoc::Generator::POT
- Inherits:
-
Object
- Object
- RDoc::Generator::POT
- Defined in:
- lib/rdoc/generator/pot.rb
Overview
Generates a POT file.
Here is a translator work flow with the generator.
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. po-mode.el exists for Emacs users. There are some GUI tools such as GTranslator. There are some Web services such as POEditor and Tansifex. 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.
Defined Under Namespace
Classes: MessageExtractor, PO, POEntry
Constant Summary collapse
- DESCRIPTION =
Description of this generator
'creates .pot file'
Instance Method Summary collapse
- #class_dir ⇒ Object
-
#generate ⇒ Object
Writes .pot to disk.
-
#initialize(store, options) ⇒ POT
constructor
Set up a new .pot generator.
Constructor Details
#initialize(store, options) ⇒ POT
Set up a new .pot generator
67 68 69 70 |
# File 'lib/rdoc/generator/pot.rb', line 67 def initialize store, #:not-new: @options = @store = store end |
Instance Method Details
#class_dir ⇒ Object
83 84 85 |
# File 'lib/rdoc/generator/pot.rb', line 83 def class_dir nil end |
#generate ⇒ Object
Writes .pot to disk.
75 76 77 78 79 80 81 |
# File 'lib/rdoc/generator/pot.rb', line 75 def generate po = pot_path = 'rdoc.pot' File.open(pot_path, "w") do |pot| pot.print(po.to_s) end end |