xgettext -d hello -s -o hello-new.pot hello.cNow, we use a new program, msgmerge, to merge the existing .po file with translations into the new template file, viz.,
msgmerge -s -U oriya.po hello-new.potThe -s option produces sorted output, and the -U option updates the existing .po file, oriya.po. We could have chosen to instead create a new .po file by using ``-o <filename>'' instead of -U. The updated .po file will still have the old translations embedded in it, and new entries with untranslated msgid lines. For us, the new lines in oriya.po will look like,
#: hello.c:11 msgid "How are you?\n" msgstr ""For the new translation, we could use, ``ଆପଣ କିପରି ଅଛନ୍ତି?'' in place of the English phrase ``How are you?'' The updated oriya.po file, including the translation might look like:
# Oriya translations for hello example package. # Copyright (C) 2004 Gora Mohanty # This file is distributed under the same license as the hello examplepackage. # Gora Mohanty <gora_mohanty@yahoo.co.in>, 2004. # msgid "" msgstr "" "Project-Id-Version: oriya\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2004-06-23 14:30+0530\n" "PO-Revision-Date: 2004-06-22 10:54+0530\n" "Last-Translator: Gora Mohanty <gora_mohanty@yahoo.co.in>\n" "Language-Team: Oriya\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.3\n" #: hello.c:10 msgid "Hello, world!\n" msgstr "ନମସ୍କାର\n" #: hello.c:11 msgid "How are you?\n" msgstr "ଆପଣକିପରି ଅଛନ୍ତି?\n"
Compile oriya.po to a machine object file, and install in the appropriate place as in Sec. 2.4. Thus,
msgfmt -c -v -o hello.mo oriya.po mkdir -p /usr/share/locale/or_IN/LC_MESSAGES cp hello.mo /usr/share/locale/or_IN/LC_MESSAGESYou can test the Oriya output as above, after recompiling hello.c and running it in an Oriya locale.
Gora Mohanty 2004-07-24