# [PATCH 2/2] l10n: de: translate describe debug terms

7 messages from 2017-03-17 to 2017-03-27. Participants: Michael J Gruber, Junio C Hamano.
Thread: https://gitlist.dev/t/45409

## Michael J Gruber, 2017-03-17 15:12

Subject: [PATCH 2/2] l10n: de: translate describe debug terms
Message-ID: <faa3afab66e0cd2f3851c41415ce08aa3c53f42b.1489763302.git.git@drmicha.warpmail.net>
URL: https://gitlist.dev/e/faa3afab66e0cd2f3851c41415ce08aa3c53f42b.1489763302.git.git%40drmicha.warpmail.net
In-Reply-To: <105f48ad2ae1aa9c88ce6088e6b304294bec0835.1489763302.git.git@drmicha.warpmail.net>

```
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
Junio: this is just a l10n-followup to the previous code patch ;)

 po/de.po | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/po/de.po b/po/de.po
index e9c86f5488..913db393dc 100644
--- a/po/de.po
+++ b/po/de.po
@@ -7530,7 +7530,19 @@ msgstr "git describe [<Optionen>] [<Commit-Angabe>...]"
 msgid "git describe [<options>] --dirty"
 msgstr "git describe [<Optionen>] --dirty"
 
-#: builtin/describe.c:217
+#: builtin/describe.c:52
+msgid "head"
+msgstr "Branch"
+
+#: builtin/describe.c:52
+msgid "lightweight"
+msgstr "nicht-annotiert"
+
+#: builtin/describe.c:52
+msgid "annotated"
+msgstr "annotiert"
+
+#: builtin/describe.c:249
 #, c-format
 msgid "annotated tag %s not available"
 msgstr "annotiertes Tag %s ist nicht verfügbar"
-- 
2.12.0.484.g92f9ab2bc1


```

## Michael J Gruber, 2017-03-17 15:12

Subject: [PATCH 1/2] describe: localize debug output fully
Message-ID: <105f48ad2ae1aa9c88ce6088e6b304294bec0835.1489763302.git.git@drmicha.warpmail.net>
URL: https://gitlist.dev/e/105f48ad2ae1aa9c88ce6088e6b304294bec0835.1489763302.git.git%40drmicha.warpmail.net

```
git describe --debug localizes all debug messages but not the terms
head, lightweight, annotated that it outputs for the candidates.
Localize them, too.

Also, increase the width of that field to create room for the translated
terms.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
Ralf: this is just the context for the following l10-de patch

 builtin/describe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin/describe.c b/builtin/describe.c
index 76c18059bf..1a760c16f9 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -49,7 +49,7 @@ struct commit_name {
 };
 
 static const char *prio_names[] = {
-	"head", "lightweight", "annotated",
+	N_("head"), N_("lightweight"), N_("annotated"),
 };
 
 static int commit_name_cmp(const struct commit_name *cn1,
@@ -396,8 +396,8 @@ static void describe(const char *arg, int last_one)
 	if (debug) {
 		for (cur_match = 0; cur_match < match_cnt; cur_match++) {
 			struct possible_tag *t = &all_matches[cur_match];
-			fprintf(stderr, " %-11s %8d %s\n",
-				prio_names[t->name->prio],
+			fprintf(stderr, " %-15s %8d %s\n",
+				_(prio_names[t->name->prio]),
 				t->depth, t->name->path);
 		}
 		fprintf(stderr, _("traversed %lu commits\n"), seen_commits);
-- 
2.12.0.484.g92f9ab2bc1


```

## Junio C Hamano, 2017-03-17 18:17

Subject: Re: [PATCH 1/2] describe: localize debug output fully
Message-ID: <xmqqpohf7opl.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqpohf7opl.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <105f48ad2ae1aa9c88ce6088e6b304294bec0835.1489763302.git.git@drmicha.warpmail.net>

```
Michael J Gruber <git@drmicha.warpmail.net> writes:

> git describe --debug localizes all debug messages but not the terms
> head, lightweight, annotated that it outputs for the candidates.
> Localize them, too.
>
> Also, increase the width of that field to create room for the translated
> terms.

If you worry about something not fitting within 11, there is no
guarantee that 15 is enough.  Wouldn't it be saner to make that
_("%-11s %8d %s\n") localizable, too?

Alternatively,

	if (debug) {
		static int label_width = -1;
		if (label_width < 0) {
			int i;
			for (i = 0; i < ARRAY_SIZE(prio_names); i++)
				... do a one-time width measurement
                                ... to set label_width
		}
		fprintf(stderr, "%-.*s %8d %s\n", 
		                label_width, _(prio_names[t->name->prio]),
				...);
	...

or something like that, perhaps?

> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
> ---
> Ralf: this is just the context for the following l10-de patch
>
>  builtin/describe.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/builtin/describe.c b/builtin/describe.c
> index 76c18059bf..1a760c16f9 100644
> --- a/builtin/describe.c
> +++ b/builtin/describe.c
> @@ -49,7 +49,7 @@ struct commit_name {
>  };
>  
>  static const char *prio_names[] = {
> -	"head", "lightweight", "annotated",
> +	N_("head"), N_("lightweight"), N_("annotated"),
>  };
>  
>  static int commit_name_cmp(const struct commit_name *cn1,
> @@ -396,8 +396,8 @@ static void describe(const char *arg, int last_one)
>  	if (debug) {
>  		for (cur_match = 0; cur_match < match_cnt; cur_match++) {
>  			struct possible_tag *t = &all_matches[cur_match];
> -			fprintf(stderr, " %-11s %8d %s\n",
> -				prio_names[t->name->prio],
> +			fprintf(stderr, " %-15s %8d %s\n",
> +				_(prio_names[t->name->prio]),
>  				t->depth, t->name->path);
>  		}
>  		fprintf(stderr, _("traversed %lu commits\n"), seen_commits);

```

## Michael J Gruber, 2017-03-27 16:50

Subject: [PATCH v2 1/2] describe: localize debug output fully
Message-ID: <baac53f99636b00880c72daf8aec4d66a4755af2.1490633145.git.git@grubix.eu>
URL: https://gitlist.dev/e/baac53f99636b00880c72daf8aec4d66a4755af2.1490633145.git.git%40grubix.eu
In-Reply-To: <xmqqpohf7opl.fsf@gitster.mtv.corp.google.com>

```
git describe --debug localizes all debug messages but not the terms
head, lightweight, annotated that it outputs for the candidates.
Localize them, too.

Signed-off-by: Michael J Gruber <git@grubix.eu>
---
 builtin/describe.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/builtin/describe.c b/builtin/describe.c
index 45adbf67d5..99e963dfe7 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -50,7 +50,7 @@ struct commit_name {
 };
 
 static const char *prio_names[] = {
-	"head", "lightweight", "annotated",
+	N_("head"), N_("lightweight"), N_("annotated"),
 };
 
 static int commit_name_cmp(const struct commit_name *cn1,
@@ -395,10 +395,19 @@ static void describe(const char *arg, int last_one)
 	free_commit_list(list);
 
 	if (debug) {
+		static int label_width = -1;
+		if (label_width < 0) {
+			int i, w;
+			for (i = 0; i < ARRAY_SIZE(prio_names); i++) {
+				w = strlen(_(prio_names[i]));
+				if (label_width < w)
+					label_width = w;
+			}
+		}		
 		for (cur_match = 0; cur_match < match_cnt; cur_match++) {
 			struct possible_tag *t = &all_matches[cur_match];
-			fprintf(stderr, " %-11s %8d %s\n",
-				prio_names[t->name->prio],
+			fprintf(stderr, " %-*s %8d %s\n",
+				label_width, _(prio_names[t->name->prio]),
 				t->depth, t->name->path);
 		}
 		fprintf(stderr, _("traversed %lu commits\n"), seen_commits);
-- 
2.12.2.584.g7becbf139a


```

## Michael J Gruber, 2017-03-27 16:50

Subject: [PATCH v2 2/2] l10n: de: translate describe debug terms
Message-ID: <685807568fdafc86707e7c99e82bf03ef8ff3a87.1490633145.git.git@grubix.eu>
URL: https://gitlist.dev/e/685807568fdafc86707e7c99e82bf03ef8ff3a87.1490633145.git.git%40grubix.eu
In-Reply-To: <xmqqpohf7opl.fsf@gitster.mtv.corp.google.com>

```
Signed-off-by: Michael J Gruber <git@grubix.eu>
---
 po/de.po | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/po/de.po b/po/de.po
index e9c86f5488..913db393dc 100644
--- a/po/de.po
+++ b/po/de.po
@@ -7530,7 +7530,19 @@ msgstr "git describe [<Optionen>] [<Commit-Angabe>...]"
 msgid "git describe [<options>] --dirty"
 msgstr "git describe [<Optionen>] --dirty"
 
-#: builtin/describe.c:217
+#: builtin/describe.c:52
+msgid "head"
+msgstr "Branch"
+
+#: builtin/describe.c:52
+msgid "lightweight"
+msgstr "nicht-annotiert"
+
+#: builtin/describe.c:52
+msgid "annotated"
+msgstr "annotiert"
+
+#: builtin/describe.c:249
 #, c-format
 msgid "annotated tag %s not available"
 msgstr "annotiertes Tag %s ist nicht verfügbar"
-- 
2.12.2.584.g7becbf139a


```

## Michael J Gruber, 2017-03-27 16:50

Subject: [PATCH v2 0/2] describe: localize debug output
Message-ID: <cover.1490633145.git.git@grubix.eu>
URL: https://gitlist.dev/e/cover.1490633145.git.git%40grubix.eu
In-Reply-To: <xmqqpohf7opl.fsf@gitster.mtv.corp.google.com>

```
v2 computes the width for the localized output dynamically.
In fact, it might overcalculated a bit depending on the encoding,
but this does not do any harm.

Michael J Gruber (2):
  describe: localize debug output fully
  l10n: de: translate describe debug terms

 builtin/describe.c | 15 ++++++++++++---
 po/de.po           | 14 +++++++++++++-
 2 files changed, 25 insertions(+), 4 deletions(-)

-- 
2.12.2.584.g7becbf139a


```

## Junio C Hamano, 2017-03-27 20:44

Subject: Re: [PATCH v2 0/2] describe: localize debug output
Message-ID: <xmqq4lye1mbp.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqq4lye1mbp.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <cover.1490633145.git.git@grubix.eu>

```
Michael J Gruber <git@grubix.eu> writes:

> v2 computes the width for the localized output dynamically.
> In fact, it might overcalculated a bit depending on the encoding,
> but this does not do any harm.

Thanks.

As you said, if we wanted to actually _align_, then it needs much
more work.  But that is not what we are aiming for in this round,
it should be alright.


```
