Subject: [PATCH 1/3] gettext: Add po/README file documenting Git's gettext

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Fri, 3 Sep 2010 23:24:54 +0000

Add a po/README file. This documentation is targated at translators
and maintainers of git.git.

Currently it describes how to add new PO files and how to update
them. But in the future we want to add more things to it, e.g. how and
what to add in TRANSLATOR comments, how to make the source more
gettext friendly etc.

Signed-off-by: Ævar Arnfjörð Bjarmason <[email-masked]>
---

Turns out we do just fine with --no-location.

 po/README |   68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 68 insertions(+), 0 deletions(-)
 create mode 100644 po/README

diff --git a/po/README b/po/README
new file mode 100644
index 0000000..cca8012
--- /dev/null
+++ b/po/README
@@ -0,0 +1,68 @@
+Core GIT Translations
+=====================
+
+This directory holds the translations for the core of Git. This
+document describes how to add to and maintain these translations.
+
+
+Generating a .pot file
+----------------------
+
+The po/git.pot file contains a message catalog extracted from Git's
+sources. You need to generate it to add new translations with
+msginit(1), or update existing ones with msgmerge(1).
+
+Since the file can be automatically generated it's not checked into
+git.git. To generate it do, at the top-level:
+
+    make pot
+
+
+Initializing a .po file
+-----------------------
+
+To add a new translation first generate git.pot (see above) and then
+in the po/ directory do:
+
+    msginit --locale=XX --no-translator
+
+Where XX is your locale, e.g. "is", "de" or "pt_BR".
+
+Then, because msginit(1) will include a lot of superfluous info we
+don't want run this on it:
+
+    perl -ni -e '
+        if (1 .. /^$/) {
+            s/^#.*\n//;
+            s/(?<=Project-Id-Version: )PACKAGE VERSION/Git/;
+            s/"(?:PO-Revision-Date|Language-Team|Last-Translator): .*\n//;
+        }
+        s/^#: .*\n//;
+        print
+    ' XX.po
+
+We omit removing "POT-Creation-Date", because msgmerge(1) always adds
+it if it isn't present, and removing it after each msgmerge is harder
+than just including it to begin with.
+
+
+Updating a .po file
+-------------------
+
+If there's an existing *.po file for your language but you need to
+update the translation you first need to generate git.pot (see above)
+and then in the po/ directory do:
+
+    msgmerge --no-location --backup=off -U XX.po git.pot
+
+Where XX.po is the file you want to update.
+
+If you want to generate location comments (it can be very useful to
+see the source for context while translating) do:
+
+    msgmerge --add-location --backup=off -U XX.po git.pot
+
+But then you need remember to remove the comments before you submit
+the file upstream:
+
+    perl -pi -e 's/^#: .*\n//' XX.po
-- 
1.7.2.2.336.g704fc