summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2014-04-21 10:42:52 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-04-21 10:42:52 -0700
commit8fe3ee67adcd2ee9372c7044fa311ce55eb285b4 (patch)
treede9808909692a95575e34d29cf0eb5b832b5c851
parentMerge branch 'km/avoid-non-function-return-in-rebase' (diff)
parenti18n: mention "TRANSLATORS:" marker in Documentation/CodingGuidelines (diff)
downloadtgif-8fe3ee67adcd2ee9372c7044fa311ce55eb285b4.tar.xz
Merge branch 'jx/i18n'
* jx/i18n: i18n: mention "TRANSLATORS:" marker in Documentation/CodingGuidelines i18n: only extract comments marked with "TRANSLATORS:" i18n: remove obsolete comments for translators in diffstat generation i18n: fix uncatchable comments for translators in date.c
-rw-r--r--Documentation/CodingGuidelines10
-rw-r--r--Makefile2
-rw-r--r--builtin/init-db.c8
-rw-r--r--date.c2
-rw-r--r--diff.c8
5 files changed, 15 insertions, 15 deletions
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index dab5c61bfe..f424dbd75c 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -164,6 +164,16 @@ For C programs:
* multi-line comment.
*/
+ Note however that a comment that explains a translatable string to
+ translators uses a convention of starting with a magic token
+ "TRANSLATORS: " immediately after the opening delimiter, even when
+ it spans multiple lines. We do not add an asterisk at the beginning
+ of each line, either. E.g.
+
+ /* TRANSLATORS: here is a comment that explains the string
+ to be translated, that follows immediately after it */
+ _("Here is a translatable string explained by the above.");
+
- Double negation is often harder to understand than no negation
at all.
diff --git a/Makefile b/Makefile
index 2128ce3ea2..a53f3a8326 100644
--- a/Makefile
+++ b/Makefile
@@ -2102,7 +2102,7 @@ pdf:
XGETTEXT_FLAGS = \
--force-po \
- --add-comments \
+ --add-comments=TRANSLATORS: \
--msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
--from-code=UTF-8
XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
diff --git a/builtin/init-db.c b/builtin/init-db.c
index c7c76bbf21..56f85e239a 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -412,11 +412,9 @@ int init_db(const char *template_dir, unsigned int flags)
if (!(flags & INIT_DB_QUIET)) {
int len = strlen(git_dir);
- /*
- * TRANSLATORS: The first '%s' is either "Reinitialized
- * existing" or "Initialized empty", the second " shared" or
- * "", and the last '%s%s' is the verbatim directory name.
- */
+ /* TRANSLATORS: The first '%s' is either "Reinitialized
+ existing" or "Initialized empty", the second " shared" or
+ "", and the last '%s%s' is the verbatim directory name. */
printf(_("%s%s Git repository in %s%s\n"),
reinit ? _("Reinitialized existing") : _("Initialized empty"),
shared_repository ? _(" shared") : "",
diff --git a/date.c b/date.c
index e1a2cee568..782de95d90 100644
--- a/date.c
+++ b/date.c
@@ -144,8 +144,8 @@ void show_date_relative(unsigned long time, int tz,
if (months) {
struct strbuf sb = STRBUF_INIT;
strbuf_addf(&sb, Q_("%lu year", "%lu years", years), years);
- /* TRANSLATORS: "%s" is "<n> years" */
strbuf_addf(timebuf,
+ /* TRANSLATORS: "%s" is "<n> years" */
Q_("%s, %lu month ago", "%s, %lu months ago", months),
sb.buf, months);
strbuf_release(&sb);
diff --git a/diff.c b/diff.c
index 539997fc6a..54d5308268 100644
--- a/diff.c
+++ b/diff.c
@@ -1461,20 +1461,12 @@ int print_stat_summary(FILE *fp, int files, int insertions, int deletions)
* but nothing about added/removed lines? Is this a bug in Git?").
*/
if (insertions || deletions == 0) {
- /*
- * TRANSLATORS: "+" in (+) is a line addition marker;
- * do not translate it.
- */
strbuf_addf(&sb,
(insertions == 1) ? ", %d insertion(+)" : ", %d insertions(+)",
insertions);
}
if (deletions || insertions == 0) {
- /*
- * TRANSLATORS: "-" in (-) is a line removal marker;
- * do not translate it.
- */
strbuf_addf(&sb,
(deletions == 1) ? ", %d deletion(-)" : ", %d deletions(-)",
deletions);