To start a new translation, the easiest way is to copy the existing POT
as article.lang.po, where lang is your language code.
For example, to prepare for a new translation of the essay
http://www.gnu.org/philosophy/free-sw.html, you can simply do
cd philosophy/po ; cp free-sw.pot free-sw.lang.po and then
edit the latter. If free-sw.pot does not exist it is because
either the article is not yet “templated” (i.e. migrated to the new
style), or the GNUN maintainers have not yet added it to the
value of the appropriate variable in server/gnun/gnun.mk. In
that case, just ask them to do the necessary in order the POT to be
generated.
You could also use the msginit utility that would populate the PO file header with the right information, provided your environment is set up correctly. See msginit Invocation.
The PO file header as generated usually looks like this:
# SOME DESCRIPTIVE TITLE
# Copyright (C) YEAR Free Software Foundation, Inc.
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2008-02-06 16:25-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"
You have to edit the header to match the already established conventions, and the rules for gnu.org translations. For reference, here is a list with all fields explained:
Elvis Parsley <king@grassland.com>
French <trad-gnu@april.org>
text/plain; charset=UTF-8; change the charset
accordingly.
8bit. Note that the PO file header ends with this
field, and it should contain a newline (‘\n’). Unfortunately, some
PO editors remove the newline, which causes an unnecessary revision when
the file is automatically modified by GNUN's rules.
Here is an example of a properly edited header:
# Bulgarian translation of http://www.gnu.org/philosophy/free-sw.html
# Copyright (C) 2008 Free Software Foundation, Inc.
# This file is distributed under the same license as the gnu.org article.
# Yavor Doganov <yavor@gnu.org>, 2008.
#
msgid ""
msgstr ""
"Project-Id-Version: free-sw.html\n"
"POT-Creation-Date: 2008-02-06 16:25-0500\n"
"PO-Revision-Date: 2008-02-09 15:23+0200\n"
"Last-Translator: Yavor Doganov <yavor@gnu.org>\n"
"Language-Team: Bulgarian <dict@fsa-bg.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8-bit\n"
Notice the absence of the “fuzzy” marker; you should “unfuzzy” the header after entering the necessary information (this is done by simply pressing <TAB> in PO mode).
There are some special messages that appear in the POT and PO:
Most of the PO editors do not wrap long lines that inevitably appear in
msgstr's. If that happens, long lines make reading subsequent
diffs harder, and are generally annoying for most people. If this issue
bothers you, you can “normalize” the already finished PO translation
by executing on the command line msgcat -o file.po
file.po, before installing it in the repository. Either way, the
build system will treat it is a valid PO file.
For those lucky Emacs users, here is a code snippet that you can put in your .emacs; doing M-x po-wrap while in PO mode will wrap all long lines:
(defun po-wrap ()
"Filter current po-mode buffer through `msgcat' tool to wrap all lines."
(interactive)
(if (eq major-mode 'po-mode)
(let ((tmp-file (make-temp-file "po-wrap."))
(tmp-buf (generate-new-buffer "*temp*")))
(unwind-protect
(progn
(write-region (point-min) (point-max) tmp-file nil 1)
(if (zerop
(call-process
"msgcat" nil tmp-buf t (shell-quote-argument tmp-file)))
(let ((saved (point))
(inhibit-read-only t))
(delete-region (point-min) (point-max))
(insert-buffer tmp-buf)
(goto-char (min saved (point-max))))
(with-current-buffer tmp-buf
(error (buffer-string)))))
(kill-buffer tmp-buf)
(delete-file tmp-file)))))
It is highly desirable that you check if the PO file you finished
translating (or editing) is valid, before committing it. This is done
by running msgfmt -cv -o /dev/null file or by simply
pressing V in PO mode. The build system automatically verifies
each PO file when invoked with VALIDATE=yes, but you won't get a
warm and fuzzy feeling if a stupid typo you made halts the whole update
of all translations. Such things happen to everyone, so it is a good
practice to check before you actually commit.