[PATCH 2/5] gettext docs: add "Marking strings for translation" section in po/README

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?=
Date: Friday, September 10, 2010 - 12:35 pm

Add a "Marking strings for translation" section to po/README and
mention it in Documentation/CodingGuidelines.

This section documents how the maintainers of Git's source code should
go about properly marking strings for translation.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Documentation/CodingGuidelines |    7 ++++++
 po/README                      |   41 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 47 insertions(+), 1 deletions(-)

diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index b8bf618..2e114d6 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -70,6 +70,10 @@ For shell scripts specifically (not exhaustive):
      are ERE elements not BRE (note that \? and \+ are not even part
      of BRE -- making them accessible from BRE is a GNU extension).
 
+ - Use Git's gettext wrappers in git-sh-i18n to make the user
+   interface translatable. See "Marking strings for translation" in
+   po/README.
+
 For C programs:
 
  - We use tabs to indent, and interpret tabs as taking up to
@@ -132,3 +136,6 @@ For C programs:
 
  - When we pass <string, length> pair to functions, we should try to
    pass them in that order.
+
+ - Use Git's gettext wrappers to make the user interface
+   translatable. See "Marking strings for translation" in po/README.
diff --git a/po/README b/po/README
index 4d23ca6..372cb9c 100644
--- a/po/README
+++ b/po/README
@@ -2,7 +2,8 @@ Core GIT Translations
 =====================
 
 This directory holds the translations for the core of Git. This
-document describes how to add to and maintain these translations.
+document describes how to add to and maintain these translations, and
+how to mark source strings for translation.
 
 
 Generating a .pot file
@@ -80,3 +81,41 @@ changed PO file with `msgfmt --check`, the --check option flags many
 common errors, e.g. missing printf format strings, or translated
 messages that deviate from the originals in whether they begin/end
 with a newline or not.
+
+
+Marking strings for translation
+-------------------------------
+
+Before strings can be translated they first have to be marked for
+translation.
+
+Git uses an internationalization interface that wraps the system's
+gettext library, so most of the advice in your gettext documentation
+(on GNU systems `info gettext` in a terminal) applies.
+
+General advice:
+
+ - Don't mark everything for translation, only strings which will be
+   read by humans (the porcelain interface) should be translated.
+
+   The output from Git's plumbing utilities will primarily be read by
+   programs and would break scripts under non-C locales. These strings
+   should not be translated.
+
+ - Adjust the strings so that they're easy to translate. Most of the
+   advice in `info '(gettext)Preparing Strings'` applies here.
+
+ - If something is unclear or ambiguous you can use a "TRANSLATORS"
+   comment to tell the translators what to make of it. These will be
+   extracted by xgettext(1) and put in the po/*.po files, e.g. from
+   git-am.sh:
+
+       # TRANSLATORS: Make sure to include [y], [n], [e], [v] and [a]
+       # in your translation. The program will only accept English
+       # input at this point.
+       gettext "Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all "
+
+   Or in C, from builtin/revert.c:
+
+       /* TRANSLATORS: %s will be "revert" or "cherry-pick" */
+       die(_("%s: Unable to write new index file"), me);
-- 
1.7.2.3.313.gcd15

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/20] [CONTINUE] Add gettext support to Git, =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:45 am)
[PATCH 01/20] gettextize: git-clean clean.requireForce braces, =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:45 am)
[PATCH 02/20] gettextize: git-clone &quot;Cloning into&quot; message ..., =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:45 am)
[PATCH 04/20] Makefile: add GNU_GETTEXT, set when we expec ..., =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:47 am)
[PATCH 05/20] Makefile: MSGFMT=&quot;msgfmt --check&quot; under GNU_ ..., =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:47 am)
[PATCH 07/20] gettextize: git-revert &quot;Your local changes&quot; ..., =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:47 am)
[PATCH 08/20] gettextize: git-revert literal &quot;me&quot; messages, =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:47 am)
[PATCH 09/20] gettext: add GETTEXT_POISON support for shel ..., =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:47 am)
[PATCH 10/20] gettext: add GETTEXT_POISON tests for shell ..., =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:48 am)
[PATCH 11/20] gettextize: git-am add git-sh-i18n, =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:48 am)
[PATCH 12/20] gettextize: git-am one-line gettext $msg; echo, =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:48 am)
[PATCH 13/20] gettextize: git-am multi-line getttext $msg; ..., =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:48 am)
[PATCH 14/20] gettextize: git-am eval_gettext messages, =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:48 am)
[PATCH 15/20] gettextize: git-am die messages, =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:48 am)
[PATCH 16/20] gettextize: git-am cannot_fallback messages, =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:48 am)
[PATCH 17/20] gettextize: git-am clean_abort messages, =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:48 am)
[PATCH 18/20] gettextize: git-am &quot;Apply?&quot; message, =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:48 am)
[PATCH 19/20] gettextize: git-am core say messages, =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:48 am)
[PATCH 20/20] gettextize: git-am printf(1) message to eval ..., =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 9:50 am)
Re: [PATCH 20/20] gettextize: git-am printf(1) message to ..., Ævar Arnfjörð Bjarmason, (Tue Sep 7, 1:29 pm)
[PATCH v2 19/20] gettextize: git-am core say messages, =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 1:45 pm)
[PATCH v2 20/20] gettextize: git-am printf(1) message to e ..., =?UTF-8?q?=C3=86var= ..., (Tue Sep 7, 1:46 pm)
Re: [PATCH 00/20] [CONTINUE] Add gettext support to Git, Junio C Hamano, (Wed Sep 8, 9:43 am)
Re: [PATCH 00/20] [CONTINUE] Add gettext support to Git, Ævar Arnfjörð Bjarmason, (Wed Sep 8, 4:32 pm)
Re: [PATCH 00/20] [CONTINUE] Add gettext support to Git, Ævar Arnfjörð Bjarmason, (Fri Sep 10, 5:00 am)
Re: [PATCH 00/20] [CONTINUE] Add gettext support to Git, Junio C Hamano, (Fri Sep 10, 9:01 am)
Re: [PATCH 00/20] [CONTINUE] Add gettext support to Git, Ævar Arnfjörð Bjarmason, (Fri Sep 10, 10:17 am)
[PATCH 0/5] gettext docs: programmer docs in po/README, =?UTF-8?q?=C3=86var= ..., (Fri Sep 10, 12:35 pm)
[PATCH 1/5] gettext docs: add a &quot;Testing your changes&quot; sec ..., =?UTF-8?q?=C3=86var= ..., (Fri Sep 10, 12:35 pm)
[PATCH 2/5] gettext docs: add "Marking strings for transla ..., =?UTF-8?q?=C3=86var= ..., (Fri Sep 10, 12:35 pm)
[PATCH 3/5] gettext docs: the gettext.h C interface, =?UTF-8?q?=C3=86var= ..., (Fri Sep 10, 12:35 pm)
[PATCH 4/5] gettext docs: the git-sh-i18n.sh Shell interface, =?UTF-8?q?=C3=86var= ..., (Fri Sep 10, 12:35 pm)
[PATCH 5/5] gettext docs: the Git::I18N Perl interface, =?UTF-8?q?=C3=86var= ..., (Fri Sep 10, 12:35 pm)
Re: [PATCH 3/5] gettext docs: the gettext.h C interface, Junio C Hamano, (Fri Sep 10, 3:30 pm)
Re: [PATCH 2/5] gettext docs: add &quot;Marking strings for tra ..., Ævar Arnfjörð Bjarmason, (Fri Sep 10, 3:31 pm)
Re: [PATCH 3/5] gettext docs: the gettext.h C interface, Junio C Hamano, (Fri Sep 10, 3:52 pm)
Re: [PATCH 3/5] gettext docs: the gettext.h C interface, Ævar Arnfjörð Bjarmason, (Fri Sep 10, 3:53 pm)
Re: [PATCH 4/5] gettext docs: the git-sh-i18n.sh Shell int ..., Ævar Arnfjörð Bjarmason, (Fri Sep 10, 3:58 pm)
Re: [PATCH 3/5] gettext docs: the gettext.h C interface, Ævar Arnfjörð Bjarmason, (Fri Sep 10, 4:03 pm)
Re: [PATCH 3/5] gettext docs: the gettext.h C interface, Junio C Hamano, (Fri Sep 10, 4:06 pm)
Re: [PATCH 3/5] gettext docs: the gettext.h C interface, Ævar Arnfjörð Bjarmason, (Fri Sep 10, 4:16 pm)
Re: [PATCH 0/5] gettext docs: programmer docs in po/README, Ævar Arnfjörð Bjarmason, (Fri Sep 10, 4:21 pm)