threads / rfc / 31448

RFC patchl10n: de.po: translate 2 new messages

Subject: [PATCH/RFC] l10n: de.po: translate 2 new messages

## tl;dr

18 messages between Sep 5, 2012 and Sep 7, 2012. Diffs are folded; open one to read it.

replies: 17people: 4as markdown or json

Ralf Thielow· Sep 5, 2012, 17:11 UTC · lore

Translate 2 new messages came from git.pot update in ccfca8d (l10n: Update git.pot (2 new, 4 removed messages)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
---
Hi German l10n team,

please review this small update on German translation. This patch here is based on a preparation commit which just contains the "msgmerge" change. For an easier review, I'll copy the first message in english in this email. The second change shows that there are some newlines, came from 'msgmerge', on places where we don't want to have them. I'll fix that soon.

A hint on this translation: I've translated "See 'git help config' and search for" as "Führe 'git help config' aus und suche nach...", not as "Siehe 'git help config' und suche nach..." because the second doesn't sound good to me. Perhaps someone else has a better idea.

Thanks, Ralf

#: builtin/push.c:151 msgid "" "push.default is unset; its implicit value is changing in\n" "Git 2.0 from 'matching' to 'simple'. To squelch this message\n" "and maintain the current behavior after the default changes, use:\n" "\n" " git config --global push.default matching\n" "\n" "To squelch this message and adopt the new behavior now, use:\n" "\n" " git config --global push.default simple\n" "\n" "See 'git help config' and search for 'push.default' for further " "information.\n" "(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode\n" "'current' instead of 'simple' if you sometimes use older versions of Git)"

 po/de.po | 20 ++++++++++++++++++--
 1 Datei geändert, 18 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)
Show changes to po/de.po +18 −2
diff --git a/po/de.po b/po/de.po
index f3d232e..df5187e 100644
--- a/po/de.po
+++ b/po/de.po
@@ -4431,6 +4431,23 @@ msgid ""
 "(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode\n"
 "'current' instead of 'simple' if you sometimes use older versions of Git)"
 msgstr ""
+"'push.default' ist nicht gesetzt; der implizit gesetzte Wert wird in\n"
+"Git 2.0 von 'matching' nach 'simple' geändert. Um diese Meldung zu unter-\n"
+"drücken und das aktuelle Verhalten nach Änderung des Standardwertes\n"
+"beizubehalten, benutze:"
+"\n"
+"  git config --global push.default matching\n"
+"\n"
+"Um diese Meldung zu unterdrücken und das neue Verhalten jetzt zu übernehmen,\n"
+"benutze:\n"
+"\n"
+"  git config --global push.default simple\n"
+"\n"
+"Führe 'git help config' aus und suche nach 'push.default' für weitere "
+"Informationen.\n"
+"(Der Modus 'simple' wurde in Git 1.7.11 eingeführt. Benutze den gleichartigen"
+" Modus 'current' anstatt 'simple', falls du gelegentlich ältere Versionen von"
+" Git benutzt)"
 
 #: builtin/push.c:199
 msgid ""
@@ -4453,7 +4470,6 @@ msgstr ""
 "für weitere Details."
 
 #: builtin/push.c:212
-#, fuzzy
 msgid ""
 "Updates were rejected because a pushed branch tip is behind its remote\n"
 "counterpart. If you did not intend to push that branch, you may want to\n"
@@ -4465,7 +4481,7 @@ msgstr ""
 "beabsichtigt hast, diesen Zweig zu versenden, kannst du auch den zu "
 "versendenden\n"
 "Zweig spezifizieren oder die Konfigurationsvariable 'push.default' zu "
-"'current'\n"
+"'simple', 'current'\n"
 "oder 'upstream' setzen, um nur den aktuellen Zweig zu versenden."
 
 #: builtin/push.c:218
-- 
1.7.12
Ralf Thielow· Sep 5, 2012, 17:21 UTC · re: Ralf Thielow · lore

Re: [PATCH/RFC] l10n: de.po: translate 2 new messages

On Wed, Sep 5, 2012 at 7:11 PM, Ralf Thielow <ralf.thielow@gmail.com> wrote:
> +" Modus 'current' anstatt 'simple', falls du gelegentlich ältere Versionen von"
> +" Git benutzt)"
Oops, i've forgot a full stop before the closing bracket. I'll fix.
Thomas Rast· Sep 6, 2012, 16:44 UTC · re: Ralf Thielow · lore

Re: [PATCH/RFC] l10n: de.po: translate 2 new messages

Ralf Thielow <ralf.thielow@gmail.com> writes:
> "(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode\n"
> "'current' instead of 'simple' if you sometimes use older versions of Git)"
[...]
> +"(Der Modus 'simple' wurde in Git 1.7.11 eingeführt. Benutze den gleichartigen"
> +" Modus 'current' anstatt 'simple', falls du gelegentlich ältere Versionen von"
> +" Git benutzt)"

You translate "similar" as "gleichartig", which sounds too much like "the same" to me. Perhaps "ähnlich"? Or is there no danger of confusing this in de_DE usage?

Ack on the rest.
-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Ralf Thielow· Sep 6, 2012, 17:15 UTC · re: Thomas Rast · lore

Re: [PATCH/RFC] l10n: de.po: translate 2 new messages

On Thu, Sep 6, 2012 at 6:44 PM, Thomas Rast <trast@inf.ethz.ch> wrote:
Show 15 quoted lines
> Ralf Thielow <ralf.thielow@gmail.com> writes:
>
>> "(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode\n"
>> "'current' instead of 'simple' if you sometimes use older versions of Git)"
> [...]
>> +"(Der Modus 'simple' wurde in Git 1.7.11 eingeführt. Benutze den gleichartigen"
>> +" Modus 'current' anstatt 'simple', falls du gelegentlich ältere Versionen von"
>> +" Git benutzt)"
>
> You translate "similar" as "gleichartig", which sounds too much like
> "the same" to me.  Perhaps "ähnlich"?  Or is there no danger of
> confusing this in de_DE usage?
>
> Ack on the rest.
>

Yeah, "ähnlich" is probably the better translation in this case. I'll change it. Thanks

Jiang Xin· Sep 7, 2012, 10:31 UTC · re: Ralf Thielow · lore

Re: [PATCH/RFC] l10n: de.po: translate 2 new messages

I just notice that the 1st line of the orignal message below has only 56 characters, much shorter than other lines. It is because this is a warning message, and would add a prefix: "warning: ".

#: builtin/push.c:151 msgid "" "push.default is unset; its implicit value is changing in\n" "Git 2.0 from 'matching' to 'simple'. To squelch this message\n" "and maintain the current behavior after the default changes, use:\n" "\n" " git config --global push.default matching\n"

For this reason, translations as follows are not well-formed. So I rewind git-po, and your commits may need a bit amend.

Swedish update from Peter:

+"push.default har inte ställts in; dess underförstådda värde ändras i\n" +"Git 2.0 från \"matching\" till \"simple\". För att undertrycka det här\n" +"meddelandet och behålla nuvarande beteende efter att förvalet ändras,\n" +"skriver du:\n" +"\n" +" git config --global push.default matching\n"

Vietnamese update form Trần Ngọc Quân:

+msgstr "" +"push.default chưa được đặt, giá trị ngầm định của nó đã được thay đổi trong\n" +"Git 2.0 từ 'matching' thành 'simple'. Để chấm dứt lời nhắc nhở này\n" +"và duy trì cách xử lý sau những thay đổi mặc định này, hãy chạy lệnh:\n" +"\n" +" git config --global push.default matching\n"

2012/9/6 Ralf Thielow <ralf.thielow@gmail.com>:
Show 95 quoted lines
> Translate 2 new messages came from git.pot update in
> ccfca8d (l10n: Update git.pot (2 new, 4 removed messages)).
>
> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
> ---
>
> Hi German l10n team,
>
> please review this small update on German translation.
> This patch here is based on a preparation commit which
> just contains the "msgmerge" change.
> For an easier review, I'll copy the first message in english
> in this email.
> The second change shows that there are some newlines, came
> from 'msgmerge', on places where we don't want to have them.
> I'll fix that soon.
>
> A hint on this translation:
> I've translated "See 'git help config' and search for" as
> "Führe 'git help config' aus und suche nach...", not as
> "Siehe 'git help config' und suche nach..." because the second
> doesn't sound good to me. Perhaps someone else has a better
> idea.
>
> Thanks,
> Ralf
>
> #: builtin/push.c:151
> msgid ""
> "push.default is unset; its implicit value is changing in\n"
> "Git 2.0 from 'matching' to 'simple'. To squelch this message\n"
> "and maintain the current behavior after the default changes, use:\n"
> "\n"
> "  git config --global push.default matching\n"
> "\n"
> "To squelch this message and adopt the new behavior now, use:\n"
> "\n"
> "  git config --global push.default simple\n"
> "\n"
> "See 'git help config' and search for 'push.default' for further "
> "information.\n"
> "(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode\n"
> "'current' instead of 'simple' if you sometimes use older versions of Git)"
>
>  po/de.po | 20 ++++++++++++++++++--
>  1 Datei geändert, 18 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)
>
> diff --git a/po/de.po b/po/de.po
> index f3d232e..df5187e 100644
> --- a/po/de.po
> +++ b/po/de.po
> @@ -4431,6 +4431,23 @@ msgid ""
>  "(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode\n"
>  "'current' instead of 'simple' if you sometimes use older versions of Git)"
>  msgstr ""
> +"'push.default' ist nicht gesetzt; der implizit gesetzte Wert wird in\n"
> +"Git 2.0 von 'matching' nach 'simple' geändert. Um diese Meldung zu unter-\n"
> +"drücken und das aktuelle Verhalten nach Änderung des Standardwertes\n"
> +"beizubehalten, benutze:"
> +"\n"
> +"  git config --global push.default matching\n"
> +"\n"
> +"Um diese Meldung zu unterdrücken und das neue Verhalten jetzt zu übernehmen,\n"
> +"benutze:\n"
> +"\n"
> +"  git config --global push.default simple\n"
> +"\n"
> +"Führe 'git help config' aus und suche nach 'push.default' für weitere "
> +"Informationen.\n"
> +"(Der Modus 'simple' wurde in Git 1.7.11 eingeführt. Benutze den gleichartigen"
> +" Modus 'current' anstatt 'simple', falls du gelegentlich ältere Versionen von"
> +" Git benutzt)"
>
>  #: builtin/push.c:199
>  msgid ""
> @@ -4453,7 +4470,6 @@ msgstr ""
>  "für weitere Details."
>
>  #: builtin/push.c:212
> -#, fuzzy
>  msgid ""
>  "Updates were rejected because a pushed branch tip is behind its remote\n"
>  "counterpart. If you did not intend to push that branch, you may want to\n"
> @@ -4465,7 +4481,7 @@ msgstr ""
>  "beabsichtigt hast, diesen Zweig zu versenden, kannst du auch den zu "
>  "versendenden\n"
>  "Zweig spezifizieren oder die Konfigurationsvariable 'push.default' zu "
> -"'current'\n"
> +"'simple', 'current'\n"
>  "oder 'upstream' setzen, um nur den aktuellen Zweig zu versenden."
>
>  #: builtin/push.c:218
> --
> 1.7.12
>
-- 
蒋鑫

北京群英汇信息技术有限公司
邮件: worldhello.net@gmail.com
网址: http://www.ossxp.com/
博客: http://www.worldhello.net/
微博: http://weibo.com/gotgit/
电话: 010-51262007, 18601196889
Ralf Thielow· Sep 7, 2012, 16:36 UTC · re: Jiang Xin · lore

Re: [PATCH/RFC] l10n: de.po: translate 2 new messages

On Fri, Sep 7, 2012 at 12:31 PM, Jiang Xin <worldhello.net@gmail.com> wrote:
Show 15 quoted lines
> I just notice that the 1st line of the orignal message below has
> only 56  characters, much shorter than other lines. It is because
> this is a warning message, and would add a prefix: "warning: ".
>
> #: builtin/push.c:151
> msgid ""
> "push.default is unset; its implicit value is changing in\n"
> "Git 2.0 from 'matching' to 'simple'. To squelch this message\n"
> "and maintain the current behavior after the default changes, use:\n"
> "\n"
> "  git config --global push.default matching\n"
>
> For this reason, translations as follows are not well-formed.
> So I rewind git-po, and your commits may need a bit amend.
>

I admit that I don't really understand what you mean. I can't see a big difference in line lengths. It's not more than others have. Do you mean that the first line just lacks of a "warning: " part? In this case, the message needs to get fixed. Imagine that this line starts with "warning: ", the updated German translation would looks like this:

msgstr "" "Warnung: 'push.default' ist nicht gesetzt; der implizit gesetzte Wert wird\n" "in Git 2.0 von 'matching' nach 'simple' geändert. Um diese Meldung zu\n" "unterdrücken und das aktuelle Verhalten nach Änderung des Standardwertes\n" "beizubehalten, benutze:" [...]

I'll send you another pull request contains this update.
Ralf Thielow· Sep 7, 2012, 17:05 UTC · re: Ralf Thielow · lore

Re: [PATCH/RFC] l10n: de.po: translate 2 new messages

On Fri, Sep 7, 2012 at 6:36 PM, Ralf Thielow <ralf.thielow@gmail.com> wrote:
Show 19 quoted lines
> On Fri, Sep 7, 2012 at 12:31 PM, Jiang Xin <worldhello.net@gmail.com> wrote:
>> I just notice that the 1st line of the orignal message below has
>> only 56  characters, much shorter than other lines. It is because
>> this is a warning message, and would add a prefix: "warning: ".
>>
>> #: builtin/push.c:151
>> msgid ""
>> "push.default is unset; its implicit value is changing in\n"
>> "Git 2.0 from 'matching' to 'simple'. To squelch this message\n"
>> "and maintain the current behavior after the default changes, use:\n"
>> "\n"
>> "  git config --global push.default matching\n"
>>
>> For this reason, translations as follows are not well-formed.
>> So I rewind git-po, and your commits may need a bit amend.
>>
>
> I admit that I don't really understand what you mean. I can't
> see a big difference in line lengths. It's not more than others

I got it. This "warning: " is added automatically. Sorry

Ralf Thielow· Sep 7, 2012, 17:12 UTC · re: Ralf Thielow · lore

Re: [PATCH/RFC] l10n: de.po: translate 2 new messages

On Fri, Sep 7, 2012 at 7:05 PM, Ralf Thielow <ralf.thielow@gmail.com> wrote:
Show 23 quoted lines
> On Fri, Sep 7, 2012 at 6:36 PM, Ralf Thielow <ralf.thielow@gmail.com> wrote:
>> On Fri, Sep 7, 2012 at 12:31 PM, Jiang Xin <worldhello.net@gmail.com> wrote:
>>> I just notice that the 1st line of the orignal message below has
>>> only 56  characters, much shorter than other lines. It is because
>>> this is a warning message, and would add a prefix: "warning: ".
>>>
>>> #: builtin/push.c:151
>>> msgid ""
>>> "push.default is unset; its implicit value is changing in\n"
>>> "Git 2.0 from 'matching' to 'simple'. To squelch this message\n"
>>> "and maintain the current behavior after the default changes, use:\n"
>>> "\n"
>>> "  git config --global push.default matching\n"
>>>
>>> For this reason, translations as follows are not well-formed.
>>> So I rewind git-po, and your commits may need a bit amend.
>>>
>>
>> I admit that I don't really understand what you mean. I can't
>> see a big difference in line lengths. It's not more than others
>
> I got it. This "warning: " is added automatically.
> Sorry
The update would looks like this:

msgstr "" "'push.default' ist nicht gesetzt; der implizit gesetzte Wert\n" "wird in Git 2.0 von 'matching' nach 'simple' geändert. Um diese Meldung zu\n" "unterdrücken und das aktuelle Verhalten nach Änderung des Standardwertes\n" ...

Junio C Hamano· Sep 7, 2012, 17:44 UTC · re: Ralf Thielow · lore

Re: [PATCH/RFC] l10n: de.po: translate 2 new messages

Ralf Thielow <ralf.thielow@gmail.com> writes:
Show 23 quoted lines
> On Fri, Sep 7, 2012 at 6:36 PM, Ralf Thielow <ralf.thielow@gmail.com> wrote:
>> On Fri, Sep 7, 2012 at 12:31 PM, Jiang Xin <worldhello.net@gmail.com> wrote:
>>> I just notice that the 1st line of the orignal message below has
>>> only 56  characters, much shorter than other lines. It is because
>>> this is a warning message, and would add a prefix: "warning: ".
>>>
>>> #: builtin/push.c:151
>>> msgid ""
>>> "push.default is unset; its implicit value is changing in\n"
>>> "Git 2.0 from 'matching' to 'simple'. To squelch this message\n"
>>> "and maintain the current behavior after the default changes, use:\n"
>>> "\n"
>>> "  git config --global push.default matching\n"
>>>
>>> For this reason, translations as follows are not well-formed.
>>> So I rewind git-po, and your commits may need a bit amend.
>>>
>>
>> I admit that I don't really understand what you mean. I can't
>> see a big difference in line lengths. It's not more than others
>
> I got it. This "warning: " is added automatically.
> Sorry
We may want to revisit this behaviour, by the way.

If you have a long string that barely happens to fit on a line with "warning: " prefix in the original, your translation might want to spell it in two lines, i.e.

	warning(_("A quick brown fox jumps over the lazy dog."));
which gives
	warning: A quick brown fox jumps over the lazy dog.<LF>
might want to turn into
	warning("AA qquuiicckk bbrroowwnn ffooxx\n"
        	"jjuummppss oovveerr tthhee llaazzyy ddoogg.");
and currently gives:
	wwaarrnniinngg: AA qquuiicckk bbrroowwnn ffooxx<LF>
        jjuummppss oovveerr tthhee llaazzyy ddoogg.<LF>
But we may want to give
	wwaarrnniinngg: AA qquuiicckk bbrroowwnn ffooxx<LF>
        wwaarrnniinngg: jjuummppss oovveerr tthhee llaazzyy ddoogg.<LF>
instead.

Check out the way advice.c::advise() does its "hints: " prefix for hints, but we probably would want to avoid anything that allocates more memory in the die() codepath.

Ralf Thielow· Sep 7, 2012, 19:05 UTC · re: Junio C Hamano · lore

[PATCH 0/2] multiline prefixes on messages

This is a short implementation of an idea i have, based on Junio's comment. It might not follows the coding style, the comments can be adverse and so on... Just want to know if it's the right direction.

This series introduces a function that allows to add a prefix to multilined messages. The function itself is an extraction of the code of "advice.c::advice()". Extract this as a separate function has the advantage that we can mark these prefixes for translation and can produce a nicer output.

Junio said that we should probably avoid memory allocation on "die()" codepaths, but "warning" messages are acceptable, I think. If the series is basically acceptable, the "usage:" messages are also a cancidate for migration to this.

Ralf Thielow (2):
  advice: extract function to print messages with prefix
  i18n: mark prefix "warning:" for translation
 advice.c | 14 ++++++++++----
 advice.h |  1 +
 usage.c  |  2 +-
 3 Dateien geändert, 12 Zeilen hinzugefügt(+), 5 Zeilen entfernt(-)
-- 
1.7.12.176.g3fc0e4c.dirty
Ralf Thielow· Sep 7, 2012, 19:05 UTC · re: Ralf Thielow · lore

[PATCH 1/2] advice: extract function to print messages with prefix

Extract a function that allows to print messages with a prefix.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
---
 advice.c | 14 ++++++++++----
 advice.h |  1 +
 2 Dateien geändert, 11 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)
Show changes to 2 files +11 −4

advice.c, advice.h

diff --git a/advice.c b/advice.c
index edfbd4a..e73d53b 100644
--- a/advice.c
+++ b/advice.c
@@ -25,25 +25,31 @@ static struct {
 	{ "detachedhead", &advice_detached_head },
 };
 
-void advise(const char *advice, ...)
+void print_with_prefix(const char *prefix, const char *msg, ...)
 {
 	struct strbuf buf = STRBUF_INIT;
 	va_list params;
 	const char *cp, *np;
 
-	va_start(params, advice);
-	strbuf_vaddf(&buf, advice, params);
+	va_start(params, msg);
+	strbuf_vaddf(&buf, msg, params);
 	va_end(params);
 
 	for (cp = buf.buf; *cp; cp = np) {
 		np = strchrnul(cp, '\n');
-		fprintf(stderr,	_("hint: %.*s\n"), (int)(np - cp), cp);
+		fprintf(stderr,	 "%s %.*s\n", prefix, (int)(np - cp), cp);
 		if (*np)
 			np++;
 	}
 	strbuf_release(&buf);
 }
 
+void advise(const char *advice, ...)
+{
+	va_list vl;
+	print_with_prefix(_("hint:"), advice, vl);
+}
+
 int git_default_advice_config(const char *var, const char *value)
 {
 	const char *k = skip_prefix(var, "advice.");
diff --git a/advice.h b/advice.h
index f3cdbbf..328e255 100644
--- a/advice.h
+++ b/advice.h
@@ -14,6 +14,7 @@ extern int advice_implicit_identity;
 extern int advice_detached_head;
 
 int git_default_advice_config(const char *var, const char *value);
+void print_with_prefix(const char *prefix, const char *msg, ...);
 void advise(const char *advice, ...);
 int error_resolve_conflict(const char *me);
 extern void NORETURN die_resolve_conflict(const char *me);
-- 
1.7.12.176.g3fc0e4c.dirty
Junio C Hamano· Sep 7, 2012, 19:32 UTC · re: Ralf Thielow · lore

Re: [PATCH 1/2] advice: extract function to print messages with prefix

Ralf Thielow <ralf.thielow@gmail.com> writes:
Show 34 quoted lines
> Extract a function that allows to print messages
> with a prefix.
>
> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
> ---
>  advice.c | 14 ++++++++++----
>  advice.h |  1 +
>  2 Dateien geändert, 11 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)
>
> diff --git a/advice.c b/advice.c
> index edfbd4a..e73d53b 100644
> --- a/advice.c
> +++ b/advice.c
> @@ -25,25 +25,31 @@ static struct {
>  	{ "detachedhead", &advice_detached_head },
>  };
>  
> -void advise(const char *advice, ...)
> +void print_with_prefix(const char *prefix, const char *msg, ...)
>  {
>  	struct strbuf buf = STRBUF_INIT;
>  	va_list params;
>  	const char *cp, *np;
>  
> -	va_start(params, advice);
> -	strbuf_vaddf(&buf, advice, params);
> +	va_start(params, msg);
> +	strbuf_vaddf(&buf, msg, params);
>  	va_end(params);
>  
>  	for (cp = buf.buf; *cp; cp = np) {
>  		np = strchrnul(cp, '\n');
> -		fprintf(stderr,	_("hint: %.*s\n"), (int)(np - cp), cp);
> +		fprintf(stderr,	 "%s %.*s\n", prefix, (int)(np - cp), cp);

Hrm, naively, printf("%s: %.*s\n", _("hint"), ...) might look more natural, but I vaguely recall that the current code places _() around the entire "hint: %.*s\n" on purpose. IIRC, it was to allow translations that flow from RTL e.g. ".siht od t'nod :tnih".

Doesn't this patch break it?
Ralf Thielow· Sep 7, 2012, 19:56 UTC · re: Junio C Hamano · lore

Re: [PATCH 1/2] advice: extract function to print messages with prefix

On Fri, Sep 7, 2012 at 9:32 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 43 quoted lines
> Ralf Thielow <ralf.thielow@gmail.com> writes:
>
>> Extract a function that allows to print messages
>> with a prefix.
>>
>> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
>> ---
>>  advice.c | 14 ++++++++++----
>>  advice.h |  1 +
>>  2 Dateien geändert, 11 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)
>>
>> diff --git a/advice.c b/advice.c
>> index edfbd4a..e73d53b 100644
>> --- a/advice.c
>> +++ b/advice.c
>> @@ -25,25 +25,31 @@ static struct {
>>       { "detachedhead", &advice_detached_head },
>>  };
>>
>> -void advise(const char *advice, ...)
>> +void print_with_prefix(const char *prefix, const char *msg, ...)
>>  {
>>       struct strbuf buf = STRBUF_INIT;
>>       va_list params;
>>       const char *cp, *np;
>>
>> -     va_start(params, advice);
>> -     strbuf_vaddf(&buf, advice, params);
>> +     va_start(params, msg);
>> +     strbuf_vaddf(&buf, msg, params);
>>       va_end(params);
>>
>>       for (cp = buf.buf; *cp; cp = np) {
>>               np = strchrnul(cp, '\n');
>> -             fprintf(stderr, _("hint: %.*s\n"), (int)(np - cp), cp);
>> +             fprintf(stderr,  "%s %.*s\n", prefix, (int)(np - cp), cp);
>
> Hrm, naively, printf("%s: %.*s\n", _("hint"), ...) might look more
> natural, but I vaguely recall that the current code places _()
> around the entire "hint: %.*s\n" on purpose.  IIRC, it was to allow
> translations that flow from RTL e.g. ".siht od t'nod :tnih".
>
> Doesn't this patch break it?

Sorry but I don't know what you mean with "translations that flow from RTL e.g. ".siht od t'nod :tnih"." so I can't check this. As far as I can see the callers only put a simple message in it, e.g. advise(_("Commit your changes or stash them to proceed.")); So I don't think that this patch would break anything.

Junio C Hamano· Sep 7, 2012, 20:52 UTC · re: Ralf Thielow · lore

Re: [PATCH 1/2] advice: extract function to print messages with prefix

Ralf Thielow <ralf.thielow@gmail.com> writes:
Show 17 quoted lines
> On Fri, Sep 7, 2012 at 9:32 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
>>> -             fprintf(stderr, _("hint: %.*s\n"), (int)(np - cp), cp);
>>> +             fprintf(stderr,  "%s %.*s\n", prefix, (int)(np - cp), cp);
>>
>> Hrm, naively, printf("%s: %.*s\n", _("hint"), ...) might look more
>> natural, but I vaguely recall that the current code places _()
>> around the entire "hint: %.*s\n" on purpose.  IIRC, it was to allow
>> translations that flow from RTL e.g. ".siht od t'nod :tnih".
>>
>> Doesn't this patch break it?
>
> Sorry but I don't know what you mean with "translations that flow
> from RTL e.g. ".siht od t'nod :tnih"." so I can't check this.
> As far as I can see the callers only put a simple message in it,
> e.g. advise(_("Commit your changes or stash them to proceed."));
> So I don't think that this patch would break anything.

Your patch would not allow target languages that want to put the _("hint") at the *tail* end of each line of the message. With the original, with something like this:

	msgid "hint: %.*s\n"
        msgstr "%.*s :tnih\n"
you could do that if you wanted to.
Ralf Thielow· Sep 7, 2012, 21:09 UTC · re: Junio C Hamano · lore

Re: [PATCH 1/2] advice: extract function to print messages with prefix

On Fri, Sep 7, 2012 at 10:52 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 29 quoted lines
> Ralf Thielow <ralf.thielow@gmail.com> writes:
>
>> On Fri, Sep 7, 2012 at 9:32 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>
>>>> -             fprintf(stderr, _("hint: %.*s\n"), (int)(np - cp), cp);
>>>> +             fprintf(stderr,  "%s %.*s\n", prefix, (int)(np - cp), cp);
>>>
>>> Hrm, naively, printf("%s: %.*s\n", _("hint"), ...) might look more
>>> natural, but I vaguely recall that the current code places _()
>>> around the entire "hint: %.*s\n" on purpose.  IIRC, it was to allow
>>> translations that flow from RTL e.g. ".siht od t'nod :tnih".
>>>
>>> Doesn't this patch break it?
>>
>> Sorry but I don't know what you mean with "translations that flow
>> from RTL e.g. ".siht od t'nod :tnih"." so I can't check this.
>> As far as I can see the callers only put a simple message in it,
>> e.g. advise(_("Commit your changes or stash them to proceed."));
>> So I don't think that this patch would break anything.
>
> Your patch would not allow target languages that want to put the
> _("hint") at the *tail* end of each line of the message.  With the
> original, with something like this:
>
>         msgid "hint: %.*s\n"
>         msgstr "%.*s :tnih\n"
>
> you could do that if you wanted to.
>

Is there a need actually? It's easy to add a "_(...)" around this string, but then we'll have a msgid in "git.pot" without ever having a sensible translation. Not?

Junio C Hamano· Sep 7, 2012, 21:16 UTC · re: Ralf Thielow · lore

Re: [PATCH 1/2] advice: extract function to print messages with prefix

Ralf Thielow <ralf.thielow@gmail.com> writes:
Show 33 quoted lines
> On Fri, Sep 7, 2012 at 10:52 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Ralf Thielow <ralf.thielow@gmail.com> writes:
>>
>>> On Fri, Sep 7, 2012 at 9:32 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>>
>>>>> -             fprintf(stderr, _("hint: %.*s\n"), (int)(np - cp), cp);
>>>>> +             fprintf(stderr,  "%s %.*s\n", prefix, (int)(np - cp), cp);
>>>>
>>>> Hrm, naively, printf("%s: %.*s\n", _("hint"), ...) might look more
>>>> natural, but I vaguely recall that the current code places _()
>>>> around the entire "hint: %.*s\n" on purpose.  IIRC, it was to allow
>>>> translations that flow from RTL e.g. ".siht od t'nod :tnih".
>>>>
>>>> Doesn't this patch break it?
>>>
>>> Sorry but I don't know what you mean with "translations that flow
>>> from RTL e.g. ".siht od t'nod :tnih"." so I can't check this.
>>> As far as I can see the callers only put a simple message in it,
>>> e.g. advise(_("Commit your changes or stash them to proceed."));
>>> So I don't think that this patch would break anything.
>>
>> Your patch would not allow target languages that want to put the
>> _("hint") at the *tail* end of each line of the message.  With the
>> original, with something like this:
>>
>>         msgid "hint: %.*s\n"
>>         msgstr "%.*s :tnih\n"
>>
>> you could do that if you wanted to.
>
> Is there a need actually?
> It's easy to add a "_(...)" around this string, but then we'll have a
> msgid in "git.pot" without ever having a sensible translation. Not?

As I said "vaguely recall", even though I don't have a first-hand experience in such a language, I know I was talked into doing it this way when we did 23cb5bf (i18n of multi-line advice messages,

Junio C Hamano· Sep 7, 2012, 21:20 UTC · re: Junio C Hamano · lore

Re: [PATCH 1/2] advice: extract function to print messages with prefix

Junio C Hamano <gitster@pobox.com> writes:
> experience in such a language, I know I was talked into doing it
> this way when we did 23cb5bf (i18n of multi-line advice messages,
> 2011-12-22).  Could you dig around the list archive to see?
Heh, don't bother.  Instead, start reading from here:
  http://thread.gmane.org/gmane.comp.version-control.git/187592/focus=187601

and learn what happened to the topic by going forward, or why it was done that way by going backwards.

Thanks.
Ralf Thielow· Sep 7, 2012, 19:05 UTC · re: Ralf Thielow · lore

[PATCH 2/2] i18n: mark prefix "warning:" for translation

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
---
 usage.c | 2 +-
 1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)
Show changes to usage.c +1 −1
diff --git a/usage.c b/usage.c
index a2a6678..162a4b2 100644
--- a/usage.c
+++ b/usage.c
@@ -44,7 +44,7 @@ static void error_builtin(const char *err, va_list params)
 
 static void warn_builtin(const char *warn, va_list params)
 {
-	vreportf("warning: ", warn, params);
+	print_with_prefix(_("warning:"), warn, params);
 }
 
 /* If we are in a dlopen()ed .so write to a global variable would segfault
-- 
1.7.12.176.g3fc0e4c.dirty

← back to recent threads