Ruby-GetText-Package documents for Translators


Here is an explanation to translate pot files for translators.

  • This example for Japanese (not 2-byte string but 1-byte alphabet).
  • the application name(textdomain) is "myapp".

Translate myapp.pot into {your_locale}/myapp.po.

Get the pot file from the maintainer.

$ mkdir ja
$ cp myapp.pot ja/myapp.po

If you have GNU GetText, it's better to use msginit instead of 'cp'. msginit set some header variables from environment variables.

$ mkdir ja
$ cd ja
$ LANG=ja_JP msginit -i ../myapp.pot -o myapp.po

Then edit myapp.po as follows.

# myapp - Hello World application.
# Copyright (C) 2005 Masao Mutoh
# This file is distributed under the same license as the Ruby.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.    <= Your(translator's) name!
#                                        <= Remove the 'fuzzy' line.
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2004-03-25 23:27+0900\n"
"PO-Revision-Date: 2005-08-05 14:39+0900\n"
"Last-Translator: Masao Mutoh <mutoh at>\n"
"Language-Team: Japanese\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;\n"

#: ../myapp.rb:7
msgid "Hello World\n"

#: myapp_plural.b:11
msgid "There is an apple.\n"
msgid_plural "There are %d apples.\n"
msgstr[0] "Ringo ga arimasu."
msgstr[1] "Ringo ga %d arimasu."
Translated strings.
[i] is the value of plural forms which defined as "Plural-Forms" in the header part. See here for more details
header part
The header is also important. Especially the Content-Type and Plural-Formas are indispensable. If you can use msginit, it's inserted by msginit, but manualy, you need to add them by yourself correctly. Check the plural line in your locale in the URL below: <URL:>

In addition, you can use tools in the GNU gettext package for maintainig the po-file.

Then, send the translated files to the maintainer.

msgid which is separated with "|"

Almost of all cases, you don't need to translate the left side of "|" because it's used from GetText.s_.

See here for more details.

#: myapp.rb:10
msgid "File|Open"
msgstr "Fairu|Hiraku"                #Wrong!
msgstr "Hiraku"                      #Correct

#: myapp.rb:14
msgid "File|Printer|Open"
msgstr "Fairu|Purinta|Setuzoku-suru" #Wrong!
msgstr "Setsuzoku-suru"              #Correct

"fuzzy" comments

If a po-file have some fuzzy comments as follows:

#: myapp.rb:7
#, fuzzy
msgid "Hello World"

Then confirm the messages(msgid and msgstr) are correct, and remove the "fuzzy" line.

#: myapp.rb:7
msgid "Hello World"

This appears to use msgmerge command.