git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] l10n: allows to translate diff messages
@ 2021-07-13 12:01 Jordi Mas via GitGitGadget
  2021-07-13 23:11 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Jordi Mas via GitGitGadget @ 2021-07-13 12:01 UTC (permalink / raw)
  To: git; +Cc: Jordi Mas, Jordi Mas

From: Jordi Mas <jmas@softcatala.org>

Allows to translate the diff messages shown when the
user commits, indicating the number of insertions,
deletions and files changed.

Signed-off-by: Jordi Mas <jmas@softcatala.org>
---
    Allow to translate diff message

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1045%2Fjordimas%2Flocalize-msg-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1045/jordimas/localize-msg-v1
Pull-Request: https://github.com/git/git/pull/1045

 diff.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/diff.c b/diff.c
index 52c791574b..29db9ce079 100644
--- a/diff.c
+++ b/diff.c
@@ -2593,7 +2593,7 @@ static void print_stat_summary_inserts_deletes(struct diff_options *options,
 	}
 
 	strbuf_addf(&sb,
-		    (files == 1) ? " %d file changed" : " %d files changed",
+		    Q_(" %d file changed", " %d files changed", files),
 		    files);
 
 	/*
@@ -2606,13 +2606,13 @@ static void print_stat_summary_inserts_deletes(struct diff_options *options,
 	 */
 	if (insertions || deletions == 0) {
 		strbuf_addf(&sb,
-			    (insertions == 1) ? ", %d insertion(+)" : ", %d insertions(+)",
+			    Q_(", %d insertion(+)", ", %d insertions(+)", insertions),
 			    insertions);
 	}
 
 	if (deletions || insertions == 0) {
 		strbuf_addf(&sb,
-			    (deletions == 1) ? ", %d deletion(-)" : ", %d deletions(-)",
+			    Q_(", %d deletion(-)", ", %d deletions(-)", deletions),
 			    deletions);
 	}
 	strbuf_addch(&sb, '\n');

base-commit: d486ca60a51c9cb1fe068803c3f540724e95e83a
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] l10n: allows to translate diff messages
  2021-07-13 12:01 [PATCH] l10n: allows to translate diff messages Jordi Mas via GitGitGadget
@ 2021-07-13 23:11 ` Junio C Hamano
  2021-07-14  0:09   ` Bagas Sanjaya
  2021-07-14  0:18   ` Ævar Arnfjörð Bjarmason
  0 siblings, 2 replies; 4+ messages in thread
From: Junio C Hamano @ 2021-07-13 23:11 UTC (permalink / raw)
  To: Jordi Mas via GitGitGadget; +Cc: git, Jordi Mas

"Jordi Mas via GitGitGadget" <gitgitgadget@gmail.com> writes:

> Subject: Re: [PATCH] l10n: allows to translate diff messages

"allow to translate" would be the right phrasing, but it is too
vague to say "diff messages".  You are only marking 3 messages for
translation when there are probably a handful more.  

You need to explain which ones, not just vague "diff messages".

I think you are focusing on the words on the "git diff --stat" and
"git diff --shortstat" summary line, so

    i18n: mark "git diff --[short]stat" summary for translation

perhaps?  And remember, i18n is the act of making the code capable
of being translated, while l10n is the act of actually translating
what i18n prepared into a particular language.  Here, i18n is more
appropriate.

> From: Jordi Mas <jmas@softcatala.org>
>
> Allows to translate the diff messages shown when the
> user commits, indicating the number of insertions,
> deletions and files changed.

Our log message first explain the current status/behaviour of the
code (and highlight the problem in it), and then gives an order to
the codebase to "be like so" in imperative mood.  Perhaps like this:

    "git diff --[short]stat" summarizes the number of paths touched
    and lines inserted and deleted.  Mark this message for
    translation.

Note that I didn't explicitly say what's wrong with the current
behaviour, but "mark for translation" as the order given to the
codebase, it should be clear enough from the context that the
problem is that it is not marked for translation.

Having said all that, I am not sure if this patch stop at a sensible
point.  At least "git diff --summary" output should also be updated
to match, as they often go hand-in-hand, no?

Also, when showing "git diff --stat" for a binary file, we'd say

	$path | Bin 1234 -> 1236 bytes

I wonder if that should also be translated.

While I am at it, there are a handful things that should NEVER be
translated in the "git diff" output.

> diff --git a/diff.c b/diff.c
> index 52c791574b..29db9ce079 100644

Between "diff --git" and "--- a/$path", there are metainfo lines
that are read by "git apply" (including this "index" line).  They
should never be translated.

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] l10n: allows to translate diff messages
  2021-07-13 23:11 ` Junio C Hamano
@ 2021-07-14  0:09   ` Bagas Sanjaya
  2021-07-14  0:18   ` Ævar Arnfjörð Bjarmason
  1 sibling, 0 replies; 4+ messages in thread
From: Bagas Sanjaya @ 2021-07-14  0:09 UTC (permalink / raw)
  To: Junio C Hamano, Jordi Mas via GitGitGadget; +Cc: git, Jordi Mas

On 14/07/21 06.11, Junio C Hamano wrote:
> Also, when showing "git diff --stat" for a binary file, we'd say
> 
> 	$path | Bin 1234 -> 1236 bytes
> 
> I wonder if that should also be translated.
> 

I think that above should also be translated, for consistency with diff 
for regular text file.

-- 
An old man doll... just what I always wanted! - Clara

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] l10n: allows to translate diff messages
  2021-07-13 23:11 ` Junio C Hamano
  2021-07-14  0:09   ` Bagas Sanjaya
@ 2021-07-14  0:18   ` Ævar Arnfjörð Bjarmason
  1 sibling, 0 replies; 4+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2021-07-14  0:18 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jordi Mas via GitGitGadget, git, Jordi Mas


On Tue, Jul 13 2021, Junio C Hamano wrote:

> "Jordi Mas via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
>> Subject: Re: [PATCH] l10n: allows to translate diff messages
>
> "allow to translate" would be the right phrasing, but it is too
> vague to say "diff messages".  You are only marking 3 messages for
> translation when there are probably a handful more.  
>
> You need to explain which ones, not just vague "diff messages".
>
> I think you are focusing on the words on the "git diff --stat" and
> "git diff --shortstat" summary line, so
>
>     i18n: mark "git diff --[short]stat" summary for translation
>
> perhaps?  And remember, i18n is the act of making the code capable
> of being translated, while l10n is the act of actually translating
> what i18n prepared into a particular language.  Here, i18n is more
> appropriate.

What i18n v.s. l10n means is quite the side-discussion, I have not heard
it used like this before, but rather as e.g. defined at :
https://www.w3.org/International/questions/qa-i18n

I.e. in git.git's case that all our gettext-ization would fall under
i18n, but l10n are generally a step beyond that, e.g. if "git status"
output entries were sorted by locale, fsck and other progress.c users
used localized numeric formatting etc.

IOW I agree that i18n is more appropriate here, I just hadn't heard
i18n/l10n used in the way that you describe.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-14  0:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-13 12:01 [PATCH] l10n: allows to translate diff messages Jordi Mas via GitGitGadget
2021-07-13 23:11 ` Junio C Hamano
2021-07-14  0:09   ` Bagas Sanjaya
2021-07-14  0:18   ` Ævar Arnfjörð Bjarmason

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).