{"thread":{"id":"57265","subject":"[PATCH 0/2] More similar messages refactoring","startedAt":"2022-01-19T09:45:06Z","lastAt":"2022-02-11T20:26:39Z","messageCount":8,"participants":["Bagas Sanjaya","René Scharfe","Ævar Arnfjörð Bjarmason","Jean-Noël AVILA","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"446487","messageId":"20220119094445.15542-1-bagasdotme@gmail.com","threadId":"57265","inReplyTo":null,"subject":"[PATCH 0/2] More similar messages refactoring","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2022-01-19T09:44:43Z","receivedAt":"2022-01-19T09:45:06Z","isPatch":true,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"We came across the need to refactor message strings when we did l10n\nwork. So let's continue the factorization work done in [1].\n\n[1]:\nhttps://lore.kernel.org/git/pull.1088.v5.git.1641412944.gitgitgadget@gmail.com/\n\nBagas Sanjaya (2):\n  sequencer: factor GIT_AUTHOR_* from message strings\n  advice: refactor \"action is not possible because you have unmerged\n    files\"\n\n advice.c    | 10 +++++-----\n sequencer.c | 12 ++++++------\n 2 files changed, 11 insertions(+), 11 deletions(-)\n\n\nbase-commit: df3c41adeb212432c53d93ce6ace5d5374dc6e11\n-- \nAn old man doll... just what I always wanted! - Clara\n\n"},{"id":"446488","messageId":"20220119094445.15542-2-bagasdotme@gmail.com","threadId":"57265","inReplyTo":"20220119094445.15542-1-bagasdotme@gmail.com","subject":"[PATCH 1/2] sequencer: factor GIT_AUTHOR_* from message strings","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2022-01-19T09:44:44Z","receivedAt":"2022-01-19T09:45:07Z","isPatch":true,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"Factor messages containing GIT_AUTHOR_* variable.\n\nSigned-off-by: Bagas Sanjaya <bagasdotme@gmail.com>\n---\n sequencer.c | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 6abd72160c..472feb053c 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -848,17 +848,17 @@ int read_author_script(const char *path, char **name, char **email, char **date,\n \tfor (i = 0; i < kv.nr; i++) {\n \t\tif (!strcmp(kv.items[i].string, \"GIT_AUTHOR_NAME\")) {\n \t\t\tif (name_i != -2)\n-\t\t\t\tname_i = error(_(\"'GIT_AUTHOR_NAME' already given\"));\n+\t\t\t\tname_i = error(_(\"'%s' already given\"), \"GIT_AUTHOR_NAME\");\n \t\t\telse\n \t\t\t\tname_i = i;\n \t\t} else if (!strcmp(kv.items[i].string, \"GIT_AUTHOR_EMAIL\")) {\n \t\t\tif (email_i != -2)\n-\t\t\t\temail_i = error(_(\"'GIT_AUTHOR_EMAIL' already given\"));\n+\t\t\t\temail_i = error(_(\"'%s' already given\"), \"GIT_AUTHOR_EMAIL\");\n \t\t\telse\n \t\t\t\temail_i = i;\n \t\t} else if (!strcmp(kv.items[i].string, \"GIT_AUTHOR_DATE\")) {\n \t\t\tif (date_i != -2)\n-\t\t\t\tdate_i = error(_(\"'GIT_AUTHOR_DATE' already given\"));\n+\t\t\t\tdate_i = error(_(\"'%s' already given\"), \"GIT_AUTHOR_DATE\");\n \t\t\telse\n \t\t\t\tdate_i = i;\n \t\t} else {\n@@ -867,11 +867,11 @@ int read_author_script(const char *path, char **name, char **email, char **date,\n \t\t}\n \t}\n \tif (name_i == -2)\n-\t\terror(_(\"missing 'GIT_AUTHOR_NAME'\"));\n+\t\terror(_(\"missing '%s'\"), \"GIT_AUTHOR_NAME\");\n \tif (email_i == -2)\n-\t\terror(_(\"missing 'GIT_AUTHOR_EMAIL'\"));\n+\t\terror(_(\"missing '%s'\"), \"GIT_AUTHOR_EMAIL\");\n \tif (date_i == -2)\n-\t\terror(_(\"missing 'GIT_AUTHOR_DATE'\"));\n+\t\terror(_(\"missing '%s'\"), \"GIT_AUTHOR_DATE\");\n \tif (date_i < 0 || email_i < 0 || date_i < 0 || err)\n \t\tgoto finish;\n \t*name = kv.items[name_i].util;\n-- \nAn old man doll... just what I always wanted! - Clara\n\n"},{"id":"446489","messageId":"20220119094445.15542-3-bagasdotme@gmail.com","threadId":"57265","inReplyTo":"20220119094445.15542-1-bagasdotme@gmail.com","subject":"[PATCH 2/2] advice: refactor \"action is not possible because you have unmerged files\"","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2022-01-19T09:44:45Z","receivedAt":"2022-01-19T09:45:11Z","isPatch":true,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"Factor action names (cherry-picking, committing, merging, pulling, and\nreverting) out of the message string.\n\nSigned-off-by: Bagas Sanjaya <bagasdotme@gmail.com>\n---\n advice.c | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/advice.c b/advice.c\nindex 1dfc91d176..4c72856478 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -175,15 +175,15 @@ void list_config_advices(struct string_list *list, const char *prefix)\n int error_resolve_conflict(const char *me)\n {\n \tif (!strcmp(me, \"cherry-pick\"))\n-\t\terror(_(\"Cherry-picking is not possible because you have unmerged files.\"));\n+\t\terror(_(\"%s is not possible because you have unmerged files.\"), \"Cherry-picking\");\n \telse if (!strcmp(me, \"commit\"))\n-\t\terror(_(\"Committing is not possible because you have unmerged files.\"));\n+\t\terror(_(\"%s is not possible because you have unmerged files.\"), \"Commiting\");\n \telse if (!strcmp(me, \"merge\"))\n-\t\terror(_(\"Merging is not possible because you have unmerged files.\"));\n+\t\terror(_(\"%s is not possible because you have unmerged files.\"), \"Merging\");\n \telse if (!strcmp(me, \"pull\"))\n-\t\terror(_(\"Pulling is not possible because you have unmerged files.\"));\n+\t\terror(_(\"%s is not possible because you have unmerged files.\"), \"Pulling\");\n \telse if (!strcmp(me, \"revert\"))\n-\t\terror(_(\"Reverting is not possible because you have unmerged files.\"));\n+\t\terror(_(\"%s is not possible because you have unmerged files.\"), \"Reverting\");\n \telse\n \t\terror(_(\"It is not possible to %s because you have unmerged files.\"),\n \t\t\tme);\n-- \nAn old man doll... just what I always wanted! - Clara\n\n"},{"id":"446494","messageId":"b49ba26e-e41b-c597-aeb4-d76c6011fbca@web.de","threadId":"57265","inReplyTo":"20220119094445.15542-3-bagasdotme@gmail.com","subject":"Re: [PATCH 2/2] advice: refactor \"action is not possible because you have unmerged files\"","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2022-01-19T11:11:33Z","receivedAt":"2022-01-19T11:11:43Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 19.01.22 um 10:44 schrieb Bagas Sanjaya:\n> Factor action names (cherry-picking, committing, merging, pulling, and\n> reverting) out of the message string.\n>\n> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>\n> ---\n>  advice.c | 10 +++++-----\n>  1 file changed, 5 insertions(+), 5 deletions(-)\n>\n> diff --git a/advice.c b/advice.c\n> index 1dfc91d176..4c72856478 100644\n> --- a/advice.c\n> +++ b/advice.c\n> @@ -175,15 +175,15 @@ void list_config_advices(struct string_list *list, const char *prefix)\n>  int error_resolve_conflict(const char *me)\n>  {\n>  \tif (!strcmp(me, \"cherry-pick\"))\n> -\t\terror(_(\"Cherry-picking is not possible because you have unmerged files.\"));\n> +\t\terror(_(\"%s is not possible because you have unmerged files.\"), \"Cherry-picking\");\n>  \telse if (!strcmp(me, \"commit\"))\n> -\t\terror(_(\"Committing is not possible because you have unmerged files.\"));\n> +\t\terror(_(\"%s is not possible because you have unmerged files.\"), \"Commiting\");\n>  \telse if (!strcmp(me, \"merge\"))\n> -\t\terror(_(\"Merging is not possible because you have unmerged files.\"));\n> +\t\terror(_(\"%s is not possible because you have unmerged files.\"), \"Merging\");\n>  \telse if (!strcmp(me, \"pull\"))\n> -\t\terror(_(\"Pulling is not possible because you have unmerged files.\"));\n> +\t\terror(_(\"%s is not possible because you have unmerged files.\"), \"Pulling\");\n>  \telse if (!strcmp(me, \"revert\"))\n> -\t\terror(_(\"Reverting is not possible because you have unmerged files.\"));\n> +\t\terror(_(\"%s is not possible because you have unmerged files.\"), \"Reverting\");\n>  \telse\n>  \t\terror(_(\"It is not possible to %s because you have unmerged files.\"),\n>  \t\t\tme);\n\nThat effectively reverts 8785c42532 (i18n: advice: internationalize\nmessage for conflicts, 2016-06-17).  Why?  Having the capitalized\nEnglish present participle of the action appear somewhere in a\ntranslated string would sure look quite foreign in some (most?)\nlanguages.\n\nRené\n"},{"id":"446499","messageId":"220119.86tudzn3i0.gmgdl@evledraar.gmail.com","threadId":"57265","inReplyTo":"20220119094445.15542-3-bagasdotme@gmail.com","subject":"Re: [PATCH 2/2] advice: refactor \"action is not possible because you have unmerged files\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-01-19T15:31:57Z","receivedAt":"2022-01-19T15:34:42Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Jan 19 2022, Bagas Sanjaya wrote:\n\n> Factor action names (cherry-picking, committing, merging, pulling, and\n> reverting) out of the message string.\n>\n> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>\n> ---\n>  advice.c | 10 +++++-----\n>  1 file changed, 5 insertions(+), 5 deletions(-)\n>\n> diff --git a/advice.c b/advice.c\n> index 1dfc91d176..4c72856478 100644\n> --- a/advice.c\n> +++ b/advice.c\n> @@ -175,15 +175,15 @@ void list_config_advices(struct string_list *list, const char *prefix)\n>  int error_resolve_conflict(const char *me)\n>  {\n>  \tif (!strcmp(me, \"cherry-pick\"))\n> -\t\terror(_(\"Cherry-picking is not possible because you have unmerged files.\"));\n> +\t\terror(_(\"%s is not possible because you have unmerged files.\"), \"Cherry-picking\");\n>  \telse if (!strcmp(me, \"commit\"))\n> -\t\terror(_(\"Committing is not possible because you have unmerged files.\"));\n> +\t\terror(_(\"%s is not possible because you have unmerged files.\"), \"Commiting\");\n>  \telse if (!strcmp(me, \"merge\"))\n> -\t\terror(_(\"Merging is not possible because you have unmerged files.\"));\n> +\t\terror(_(\"%s is not possible because you have unmerged files.\"), \"Merging\");\n>  \telse if (!strcmp(me, \"pull\"))\n> -\t\terror(_(\"Pulling is not possible because you have unmerged files.\"));\n> +\t\terror(_(\"%s is not possible because you have unmerged files.\"), \"Pulling\");\n>  \telse if (!strcmp(me, \"revert\"))\n> -\t\terror(_(\"Reverting is not possible because you have unmerged files.\"));\n> +\t\terror(_(\"%s is not possible because you have unmerged files.\"), \"Reverting\");\n>  \telse\n>  \t\terror(_(\"It is not possible to %s because you have unmerged files.\"),\n>  \t\t\tme);\n\nRené correctly notes downthread that we shouldn't change this, we have\nplenty of these in git now to make these translatable to multiple\nlanguages.\n\nJust a tip that if you are refactoring something like this in that way\nand we should change it, this is much nicer:\n\n\terror(_(\"%s is not possible because you have unmerged files.\"),\n\t     !strcmp(me, \"cherry-pick\") ? \"Cherry-picking\" :\n             !strcmp(me, \"commit\") ? \"Committing\" :\n             [...]\n\nI.e. if we could do your proposed de-duplication we can also\nde-duplicate this whole else if chain in favor of a less verbose ternary\noperation.\n"},{"id":"446500","messageId":"3083234.G16DuhSZxH@cayenne","threadId":"57265","inReplyTo":"20220119094445.15542-3-bagasdotme@gmail.com","subject":"Re: [PATCH 2/2] advice: refactor \"action is not possible because you have unmerged files\"","fromName":"Jean-Noël AVILA","fromEmail":"jn.avila@free.fr","sentAt":"2022-01-19T15:42:35Z","receivedAt":"2022-01-19T15:42:44Z","isPatch":true,"sender":{"key":"jn.avila@free.fr","avatar":"https://avatars.githubusercontent.com/u/156172?v=4"},"body":"On Wednesday, 19 January 2022 10:44:45 CET Bagas Sanjaya wrote:\n> Factor action names (cherry-picking, committing, merging, pulling, and\n> reverting) out of the message string.\n> \n> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>\n> ---\n>  advice.c | 10 +++++-----\n>  1 file changed, 5 insertions(+), 5 deletions(-)\n> \n> diff --git a/advice.c b/advice.c\n> index 1dfc91d176..4c72856478 100644\n> --- a/advice.c\n> +++ b/advice.c\n> @@ -175,15 +175,15 @@ void list_config_advices(struct string_list *list, \nconst char *prefix)\n>  int error_resolve_conflict(const char *me)\n>  {\n>  \tif (!strcmp(me, \"cherry-pick\"))\n> -\t\terror(_(\"Cherry-picking is not possible because you \nhave unmerged files.\"));\n> +\t\terror(_(\"%s is not possible because you have unmerged \nfiles.\"), \"Cherry-picking\");\n>  \telse if (!strcmp(me, \"commit\"))\n> -\t\terror(_(\"Committing is not possible because you have \nunmerged files.\"));\n> +\t\terror(_(\"%s is not possible because you have unmerged \nfiles.\"), \"Commiting\");\n>  \telse if (!strcmp(me, \"merge\"))\n> -\t\terror(_(\"Merging is not possible because you have \nunmerged files.\"));\n> +\t\terror(_(\"%s is not possible because you have unmerged \nfiles.\"), \"Merging\");\n>  \telse if (!strcmp(me, \"pull\"))\n> -\t\terror(_(\"Pulling is not possible because you have \nunmerged files.\"));\n> +\t\terror(_(\"%s is not possible because you have unmerged \nfiles.\"), \"Pulling\");\n>  \telse if (!strcmp(me, \"revert\"))\n> -\t\terror(_(\"Reverting is not possible because you have \nunmerged files.\"));\n> +\t\terror(_(\"%s is not possible because you have unmerged \nfiles.\"), \"Reverting\");\n>  \telse\n>  \t\terror(_(\"It is not possible to %s because you have \nunmerged files.\"),\n>  \t\t\tme);\n> \n\nThese strings don't qualify for factorization, because the words that you are \nextracting are English words that need to be translated. We can only extract \nwords that are know to be constant, such as options, configuration, environment \nvariables.\n\nPlaying grammar lego with sentences makes it impossible for translators to find \na good translation.\n\nJN\n\n\n\n"},{"id":"446514","messageId":"xmqqh79zoahk.fsf@gitster.g","threadId":"57265","inReplyTo":"3083234.G16DuhSZxH@cayenne","subject":"Re: [PATCH 2/2] advice: refactor \"action is not possible because you have unmerged files\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-01-19T18:18:15Z","receivedAt":"2022-01-19T18:18:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jean-Noël AVILA <jn.avila@free.fr> writes:\n\n> Playing grammar lego with sentences makes it impossible for translators to find \n> a good translation.\n\nWell said.\n\nThanks.\n"},{"id":"448250","messageId":"1714138.cFTly08FWO@cayenne","threadId":"57265","inReplyTo":"20220119094445.15542-2-bagasdotme@gmail.com","subject":"Re: [PATCH 1/2] sequencer: factor GIT_AUTHOR_* from message strings","fromName":"Jean-Noël AVILA","fromEmail":"jn.avila@free.fr","sentAt":"2022-02-11T20:26:28Z","receivedAt":"2022-02-11T20:26:39Z","isPatch":true,"sender":{"key":"jn.avila@free.fr","avatar":"https://avatars.githubusercontent.com/u/156172?v=4"},"body":"Hi,\n\nNote that this patch is still relevant from an i18n point of view.\n\nIf  you do not wish to propose it, I'll cherry-pick it for my next series.\n\nBest regards,\n\nJean-Noël\n\n\n"}]}