git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Sep 3, 2010, 23:24 UTC
Message-ID
<1283556296-7365-2-git-send-email-avarab@gmail.com>
In-Reply-To
<AANLkTi=6ctLp-8FeqOGMZuhwvM_7DbaEp7+LK4nXfCaE@mail.gmail.com>

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 <avarab@gmail.com>
---
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
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 3 of 15 in “[GIT PULL] New ab/i18n series and builtin fixes”
  1. Ævar Arnfjörð BjarmasonSep 3, 2010
  2. 0/3 ab/i18n: README and GETTEXT_POISON supportÆvar Arnfjörð Bjarmason, Sep 3, 2010
  3. 1/3 gettext: Add po/README file documenting Git's gettextÆvar Arnfjörð Bjarmason, Sep 3, 2010
  4. 2/3 gettext: Add GETTEXT_POISON=YesPlease Makefile parameterÆvar Arnfjörð Bjarmason, Sep 3, 2010
  5. 3/3 gettext: add NO_GETTEXT_POISON prerequisite to testsÆvar Arnfjörð Bjarmason, Sep 3, 2010
  6. Ævar Arnfjörð BjarmasonSep 3, 2010
  7. 0/2 [PULL] ab/i18n-gettextize & translationsavarab@gmail.com, Sep 4, 2010
  8. 1/2 po/de.po: add German translationavarab@gmail.com, Sep 4, 2010
  9. Thomas RastSep 6, 2010
  10. Jan KrügerSep 6, 2010
  11. Ævar Arnfjörð BjarmasonSep 6, 2010
  12. Jens LehmannSep 6, 2010
  13. Tilo SchwarzSep 6, 2010
  14. Ævar Arnfjörð BjarmasonSep 6, 2010
  15. 2/2 po/en_GB.po: add British English Translationavarab@gmail.com, Sep 4, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.