Prev | Current Page 381 | Next

Brad Ediger

"Advanced Rails"

pot-files is xgettext; the Ruby-gettext version
is called rgettext.
$ rgettext hello.rb -o hello.pot
The resulting hello.pot file has several lines of boilerplate, followed by the extracted
strings for translation??”in this case, only one:
hello.pot
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR , YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2007-10-19 12:20-0500\n"
"PO-Revision-Date: 2007-10-19 12:20-0500\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
#: hello.rb:9
msgid "Hello, world!"
msgstr ""
This file is ready to be translated. The translator receives hello.pot from the developer
and copies it into a directory corresponding to the destination locale. Ruby-gettext provides
tools for this, but we will use the GNU gettext msginit; the Ruby-gettext
documentation recommends using it if it is available.
$ mkdir -p locale/es
$ cd locale/es/
$ LANG=es_MX msginit -i ../../hello.pot -o hello.po
(...)
Couldn't find out about your email address.
Please enter your email address.


Pages:
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393