* 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