git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/2] More similar messages refactoring
@ 2022-01-19  9:44 Bagas Sanjaya
  2022-01-19  9:44 ` [PATCH 1/2] sequencer: factor GIT_AUTHOR_* from message strings Bagas Sanjaya
  2022-01-19  9:44 ` [PATCH 2/2] advice: refactor "action is not possible because you have unmerged files" Bagas Sanjaya
  0 siblings, 2 replies; 8+ messages in thread
From: Bagas Sanjaya @ 2022-01-19  9:44 UTC (permalink / raw)
  To: git
  Cc: Johannes Sixt, Ævar Arnfjörð Bjarmason,
	René Scharfe, Jean-Noël Avila, Bagas Sanjaya

We came across the need to refactor message strings when we did l10n
work. So let's continue the factorization work done in [1].

[1]:
https://lore.kernel.org/git/pull.1088.v5.git.1641412944.gitgitgadget@gmail.com/

Bagas Sanjaya (2):
  sequencer: factor GIT_AUTHOR_* from message strings
  advice: refactor "action is not possible because you have unmerged
    files"

 advice.c    | 10 +++++-----
 sequencer.c | 12 ++++++------
 2 files changed, 11 insertions(+), 11 deletions(-)


base-commit: df3c41adeb212432c53d93ce6ace5d5374dc6e11
-- 
An old man doll... just what I always wanted! - Clara


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

* [PATCH 1/2] sequencer: factor GIT_AUTHOR_* from message strings
  2022-01-19  9:44 [PATCH 0/2] More similar messages refactoring Bagas Sanjaya
@ 2022-01-19  9:44 ` Bagas Sanjaya
  2022-02-11 20:26   ` Jean-Noël AVILA
  2022-01-19  9:44 ` [PATCH 2/2] advice: refactor "action is not possible because you have unmerged files" Bagas Sanjaya
  1 sibling, 1 reply; 8+ messages in thread
From: Bagas Sanjaya @ 2022-01-19  9:44 UTC (permalink / raw)
  To: git
  Cc: Johannes Sixt, Ævar Arnfjörð Bjarmason,
	René Scharfe, Jean-Noël Avila, Bagas Sanjaya

Factor messages containing GIT_AUTHOR_* variable.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---
 sequencer.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sequencer.c b/sequencer.c
index 6abd72160c..472feb053c 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -848,17 +848,17 @@ int read_author_script(const char *path, char **name, char **email, char **date,
 	for (i = 0; i < kv.nr; i++) {
 		if (!strcmp(kv.items[i].string, "GIT_AUTHOR_NAME")) {
 			if (name_i != -2)
-				name_i = error(_("'GIT_AUTHOR_NAME' already given"));
+				name_i = error(_("'%s' already given"), "GIT_AUTHOR_NAME");
 			else
 				name_i = i;
 		} else if (!strcmp(kv.items[i].string, "GIT_AUTHOR_EMAIL")) {
 			if (email_i != -2)
-				email_i = error(_("'GIT_AUTHOR_EMAIL' already given"));
+				email_i = error(_("'%s' already given"), "GIT_AUTHOR_EMAIL");
 			else
 				email_i = i;
 		} else if (!strcmp(kv.items[i].string, "GIT_AUTHOR_DATE")) {
 			if (date_i != -2)
-				date_i = error(_("'GIT_AUTHOR_DATE' already given"));
+				date_i = error(_("'%s' already given"), "GIT_AUTHOR_DATE");
 			else
 				date_i = i;
 		} else {
@@ -867,11 +867,11 @@ int read_author_script(const char *path, char **name, char **email, char **date,
 		}
 	}
 	if (name_i == -2)
-		error(_("missing 'GIT_AUTHOR_NAME'"));
+		error(_("missing '%s'"), "GIT_AUTHOR_NAME");
 	if (email_i == -2)
-		error(_("missing 'GIT_AUTHOR_EMAIL'"));
+		error(_("missing '%s'"), "GIT_AUTHOR_EMAIL");
 	if (date_i == -2)
-		error(_("missing 'GIT_AUTHOR_DATE'"));
+		error(_("missing '%s'"), "GIT_AUTHOR_DATE");
 	if (date_i < 0 || email_i < 0 || date_i < 0 || err)
 		goto finish;
 	*name = kv.items[name_i].util;
-- 
An old man doll... just what I always wanted! - Clara


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

* [PATCH 2/2] advice: refactor "action is not possible because you have unmerged files"
  2022-01-19  9:44 [PATCH 0/2] More similar messages refactoring Bagas Sanjaya
  2022-01-19  9:44 ` [PATCH 1/2] sequencer: factor GIT_AUTHOR_* from message strings Bagas Sanjaya
@ 2022-01-19  9:44 ` Bagas Sanjaya
  2022-01-19 11:11   ` René Scharfe
                     ` (2 more replies)
  1 sibling, 3 replies; 8+ messages in thread
From: Bagas Sanjaya @ 2022-01-19  9:44 UTC (permalink / raw)
  To: git
  Cc: Johannes Sixt, Ævar Arnfjörð Bjarmason,
	René Scharfe, Jean-Noël Avila, Bagas Sanjaya

Factor action names (cherry-picking, committing, merging, pulling, and
reverting) out of the message string.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---
 advice.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/advice.c b/advice.c
index 1dfc91d176..4c72856478 100644
--- a/advice.c
+++ b/advice.c
@@ -175,15 +175,15 @@ void list_config_advices(struct string_list *list, const char *prefix)
 int error_resolve_conflict(const char *me)
 {
 	if (!strcmp(me, "cherry-pick"))
-		error(_("Cherry-picking is not possible because you have unmerged files."));
+		error(_("%s is not possible because you have unmerged files."), "Cherry-picking");
 	else if (!strcmp(me, "commit"))
-		error(_("Committing is not possible because you have unmerged files."));
+		error(_("%s is not possible because you have unmerged files."), "Commiting");
 	else if (!strcmp(me, "merge"))
-		error(_("Merging is not possible because you have unmerged files."));
+		error(_("%s is not possible because you have unmerged files."), "Merging");
 	else if (!strcmp(me, "pull"))
-		error(_("Pulling is not possible because you have unmerged files."));
+		error(_("%s is not possible because you have unmerged files."), "Pulling");
 	else if (!strcmp(me, "revert"))
-		error(_("Reverting is not possible because you have unmerged files."));
+		error(_("%s is not possible because you have unmerged files."), "Reverting");
 	else
 		error(_("It is not possible to %s because you have unmerged files."),
 			me);
-- 
An old man doll... just what I always wanted! - Clara


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

* Re: [PATCH 2/2] advice: refactor "action is not possible because you have unmerged files"
  2022-01-19  9:44 ` [PATCH 2/2] advice: refactor "action is not possible because you have unmerged files" Bagas Sanjaya
@ 2022-01-19 11:11   ` René Scharfe
  2022-01-19 15:31   ` Ævar Arnfjörð Bjarmason
  2022-01-19 15:42   ` Jean-Noël AVILA
  2 siblings, 0 replies; 8+ messages in thread
From: René Scharfe @ 2022-01-19 11:11 UTC (permalink / raw)
  To: Bagas Sanjaya, git
  Cc: Johannes Sixt, Ævar Arnfjörð Bjarmason,
	Jean-Noël Avila

Am 19.01.22 um 10:44 schrieb Bagas Sanjaya:
> Factor action names (cherry-picking, committing, merging, pulling, and
> reverting) out of the message string.
>
> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
> ---
>  advice.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/advice.c b/advice.c
> index 1dfc91d176..4c72856478 100644
> --- a/advice.c
> +++ b/advice.c
> @@ -175,15 +175,15 @@ void list_config_advices(struct string_list *list, const char *prefix)
>  int error_resolve_conflict(const char *me)
>  {
>  	if (!strcmp(me, "cherry-pick"))
> -		error(_("Cherry-picking is not possible because you have unmerged files."));
> +		error(_("%s is not possible because you have unmerged files."), "Cherry-picking");
>  	else if (!strcmp(me, "commit"))
> -		error(_("Committing is not possible because you have unmerged files."));
> +		error(_("%s is not possible because you have unmerged files."), "Commiting");
>  	else if (!strcmp(me, "merge"))
> -		error(_("Merging is not possible because you have unmerged files."));
> +		error(_("%s is not possible because you have unmerged files."), "Merging");
>  	else if (!strcmp(me, "pull"))
> -		error(_("Pulling is not possible because you have unmerged files."));
> +		error(_("%s is not possible because you have unmerged files."), "Pulling");
>  	else if (!strcmp(me, "revert"))
> -		error(_("Reverting is not possible because you have unmerged files."));
> +		error(_("%s is not possible because you have unmerged files."), "Reverting");
>  	else
>  		error(_("It is not possible to %s because you have unmerged files."),
>  			me);

That effectively reverts 8785c42532 (i18n: advice: internationalize
message for conflicts, 2016-06-17).  Why?  Having the capitalized
English present participle of the action appear somewhere in a
translated string would sure look quite foreign in some (most?)
languages.

René

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

* Re: [PATCH 2/2] advice: refactor "action is not possible because you have unmerged files"
  2022-01-19  9:44 ` [PATCH 2/2] advice: refactor "action is not possible because you have unmerged files" Bagas Sanjaya
  2022-01-19 11:11   ` René Scharfe
@ 2022-01-19 15:31   ` Ævar Arnfjörð Bjarmason
  2022-01-19 15:42   ` Jean-Noël AVILA
  2 siblings, 0 replies; 8+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2022-01-19 15:31 UTC (permalink / raw)
  To: Bagas Sanjaya; +Cc: git, Johannes Sixt, René Scharfe, Jean-Noël Avila


On Wed, Jan 19 2022, Bagas Sanjaya wrote:

> Factor action names (cherry-picking, committing, merging, pulling, and
> reverting) out of the message string.
>
> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
> ---
>  advice.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/advice.c b/advice.c
> index 1dfc91d176..4c72856478 100644
> --- a/advice.c
> +++ b/advice.c
> @@ -175,15 +175,15 @@ void list_config_advices(struct string_list *list, const char *prefix)
>  int error_resolve_conflict(const char *me)
>  {
>  	if (!strcmp(me, "cherry-pick"))
> -		error(_("Cherry-picking is not possible because you have unmerged files."));
> +		error(_("%s is not possible because you have unmerged files."), "Cherry-picking");
>  	else if (!strcmp(me, "commit"))
> -		error(_("Committing is not possible because you have unmerged files."));
> +		error(_("%s is not possible because you have unmerged files."), "Commiting");
>  	else if (!strcmp(me, "merge"))
> -		error(_("Merging is not possible because you have unmerged files."));
> +		error(_("%s is not possible because you have unmerged files."), "Merging");
>  	else if (!strcmp(me, "pull"))
> -		error(_("Pulling is not possible because you have unmerged files."));
> +		error(_("%s is not possible because you have unmerged files."), "Pulling");
>  	else if (!strcmp(me, "revert"))
> -		error(_("Reverting is not possible because you have unmerged files."));
> +		error(_("%s is not possible because you have unmerged files."), "Reverting");
>  	else
>  		error(_("It is not possible to %s because you have unmerged files."),
>  			me);

René correctly notes downthread that we shouldn't change this, we have
plenty of these in git now to make these translatable to multiple
languages.

Just a tip that if you are refactoring something like this in that way
and we should change it, this is much nicer:

	error(_("%s is not possible because you have unmerged files."),
	     !strcmp(me, "cherry-pick") ? "Cherry-picking" :
             !strcmp(me, "commit") ? "Committing" :
             [...]

I.e. if we could do your proposed de-duplication we can also
de-duplicate this whole else if chain in favor of a less verbose ternary
operation.

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

* Re: [PATCH 2/2] advice: refactor "action is not possible because you have unmerged files"
  2022-01-19  9:44 ` [PATCH 2/2] advice: refactor "action is not possible because you have unmerged files" Bagas Sanjaya
  2022-01-19 11:11   ` René Scharfe
  2022-01-19 15:31   ` Ævar Arnfjörð Bjarmason
@ 2022-01-19 15:42   ` Jean-Noël AVILA
  2022-01-19 18:18     ` Junio C Hamano
  2 siblings, 1 reply; 8+ messages in thread
From: Jean-Noël AVILA @ 2022-01-19 15:42 UTC (permalink / raw)
  To: git, Bagas Sanjaya
  Cc: Johannes Sixt, Ævar Arnfjörð Bjarmason,
	René Scharfe, Bagas Sanjaya

On Wednesday, 19 January 2022 10:44:45 CET Bagas Sanjaya wrote:
> Factor action names (cherry-picking, committing, merging, pulling, and
> reverting) out of the message string.
> 
> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
> ---
>  advice.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/advice.c b/advice.c
> index 1dfc91d176..4c72856478 100644
> --- a/advice.c
> +++ b/advice.c
> @@ -175,15 +175,15 @@ void list_config_advices(struct string_list *list, 
const char *prefix)
>  int error_resolve_conflict(const char *me)
>  {
>  	if (!strcmp(me, "cherry-pick"))
> -		error(_("Cherry-picking is not possible because you 
have unmerged files."));
> +		error(_("%s is not possible because you have unmerged 
files."), "Cherry-picking");
>  	else if (!strcmp(me, "commit"))
> -		error(_("Committing is not possible because you have 
unmerged files."));
> +		error(_("%s is not possible because you have unmerged 
files."), "Commiting");
>  	else if (!strcmp(me, "merge"))
> -		error(_("Merging is not possible because you have 
unmerged files."));
> +		error(_("%s is not possible because you have unmerged 
files."), "Merging");
>  	else if (!strcmp(me, "pull"))
> -		error(_("Pulling is not possible because you have 
unmerged files."));
> +		error(_("%s is not possible because you have unmerged 
files."), "Pulling");
>  	else if (!strcmp(me, "revert"))
> -		error(_("Reverting is not possible because you have 
unmerged files."));
> +		error(_("%s is not possible because you have unmerged 
files."), "Reverting");
>  	else
>  		error(_("It is not possible to %s because you have 
unmerged files."),
>  			me);
> 

These strings don't qualify for factorization, because the words that you are 
extracting are English words that need to be translated. We can only extract 
words that are know to be constant, such as options, configuration, environment 
variables.

Playing grammar lego with sentences makes it impossible for translators to find 
a good translation.

JN




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

* Re: [PATCH 2/2] advice: refactor "action is not possible because you have unmerged files"
  2022-01-19 15:42   ` Jean-Noël AVILA
@ 2022-01-19 18:18     ` Junio C Hamano
  0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2022-01-19 18:18 UTC (permalink / raw)
  To: Jean-Noël AVILA
  Cc: git, Bagas Sanjaya, Johannes Sixt,
	Ævar Arnfjörð Bjarmason, René Scharfe

Jean-Noël AVILA <jn.avila@free.fr> writes:

> Playing grammar lego with sentences makes it impossible for translators to find 
> a good translation.

Well said.

Thanks.

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

* Re: [PATCH 1/2] sequencer: factor GIT_AUTHOR_* from message strings
  2022-01-19  9:44 ` [PATCH 1/2] sequencer: factor GIT_AUTHOR_* from message strings Bagas Sanjaya
@ 2022-02-11 20:26   ` Jean-Noël AVILA
  0 siblings, 0 replies; 8+ messages in thread
From: Jean-Noël AVILA @ 2022-02-11 20:26 UTC (permalink / raw)
  To: git, Bagas Sanjaya
  Cc: Johannes Sixt, Ævar Arnfjörð Bjarmason,
	René Scharfe, Bagas Sanjaya

Hi,

Note that this patch is still relevant from an i18n point of view.

If  you do not wish to propose it, I'll cherry-pick it for my next series.

Best regards,

Jean-Noël



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

end of thread, other threads:[~2022-02-11 20:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19  9:44 [PATCH 0/2] More similar messages refactoring Bagas Sanjaya
2022-01-19  9:44 ` [PATCH 1/2] sequencer: factor GIT_AUTHOR_* from message strings Bagas Sanjaya
2022-02-11 20:26   ` Jean-Noël AVILA
2022-01-19  9:44 ` [PATCH 2/2] advice: refactor "action is not possible because you have unmerged files" Bagas Sanjaya
2022-01-19 11:11   ` René Scharfe
2022-01-19 15:31   ` Ævar Arnfjörð Bjarmason
2022-01-19 15:42   ` Jean-Noël AVILA
2022-01-19 18:18     ` Junio C Hamano

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).