git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH] sequencer: do not translate reflog messages

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Aug 16, 2022, 08:59 UTC
Message-ID
<870072d5-d220-09e7-684b-f9d7d8d59c93@gmail.com>
In-Reply-To
<92sr80s2-6311-p065-755s-61s28s543q6n@tzk.qr>
Hi Dscho
On 15/08/2022 21:20, Johannes Schindelin wrote:
Show 22 quoted lines
> Hi Junio,
> 
> On Fri, 12 Aug 2022, Junio C Hamano wrote:
> 
>> Phillip Wood <phillip.wood123@gmail.com> writes:
>>
>>> Removing the N_() stops these strings from being extracted for
>>> translation, but there are several callers left that are still using
>>> _() to get the (now non-existent) translated string. I only had a
>>> quick look but I think we should remove the _() from all the callers
>>> of action_name().
>>
>> Thanks, that's all correct.
> 
> I am afraid that it is not.
> 
> In https://github.com/git/git/blob/v2.37.2/sequencer.c#L502-L503, for
> example, we use the value returned by `action_name()` in a translated
> message:
> 
> 	error(_("your local changes would be overwritten by %s."),
> 		_(action_name(opts)));

Isn't this message using action_name() to get the name of the command that the user ran? As that name is not localized when the user runs the command I don't see that we should be translating it (and playing sentence lego with the result) in this message. I think the same applies to the message at line 689 that you mention below.

Best Wishes
Phillip
Show 39 quoted lines
> Michael, I am afraid that we need more nuance here.
> 
> I do see that https://github.com/git/git/blob/v2.37.2/sequencer.c#L4316
> calls `action_name()` without wrapping it in `_(...)`:
> 
> 	setenv(GIT_REFLOG_ACTION, action_name(opts), 0);
> 
> This suggests to me that the proper solution will be to carefully vet
> which `_(action_name())` calls should drop the `_(...)` and which ones
> should not, and to leave the `N_(...)` parts alone.
> 
> The affected calls seem to fall into these categories:
> 
> - reflog (do _not_ translate the action name)
> 
> - parameter of `error_resolve_conflict()` (do _not_ translate the
>    parameter)
> 
> - error messages talking about `git <command>` (do _not_ translate the
>    action name)
> 
> - error messages talking about the operation (_do_ translate the action
>    name)
> 
> My take on which lines need to be patched:
> 
> - https://github.com/git/git/blob/v2.37.2/sequencer.c#L500
> - https://github.com/git/git/blob/v2.37.2/sequencer.c#L538
> - https://github.com/git/git/blob/v2.37.2/sequencer.c#L2384
> - https://github.com/git/git/blob/v2.37.2/sequencer.c#L2392
> - https://github.com/git/git/blob/v2.37.2/sequencer.c#L3715
> 
> but not
> 
> - https://github.com/git/git/blob/v2.37.2/sequencer.c#L503
> - https://github.com/git/git/blob/v2.37.2/sequencer.c#L689
> 
> Ciao,
> Dscho
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 6 of 34 in “sequencer: do not translate reflog messages”
  1. sequencer: do not translate reflog messagesMichael J Gruber, Aug 12, 2022
  2. Junio C HamanoAug 12, 2022
  3. Phillip WoodAug 12, 2022
  4. Junio C HamanoAug 12, 2022
  5. Johannes SchindelinAug 15, 2022
  6. Phillip WoodAug 16, 2022
  7. Johannes SchindelinAug 16, 2022
  8. 0/4 sequencer: clarify translationsMichael J Gruber, Aug 18, 2022
  9. 3/4 sequencer: do not translate command namesMichael J Gruber, Aug 18, 2022
  10. 1/4 sequencer: do not translate reflog messagesMichael J Gruber, Aug 18, 2022
  11. Ævar Arnfjörð BjarmasonAug 18, 2022
  12. Johannes SchindelinAug 19, 2022
  13. Ævar Arnfjörð BjarmasonAug 19, 2022
  14. Junio C HamanoAug 19, 2022
  15. Ævar Arnfjörð BjarmasonAug 19, 2022
  16. Junio C HamanoAug 19, 2022
  17. Ævar Arnfjörð BjarmasonAug 19, 2022
  18. Jeff KingAug 20, 2022
  19. Junio C HamanoAug 20, 2022
  20. 2/4 sequencer: do not translate parameters to error_resolve_conflict()Michael J Gruber, Aug 18, 2022
  21. Ævar Arnfjörð BjarmasonAug 18, 2022
  22. Michael J GruberAug 18, 2022
  23. Junio C HamanoAug 18, 2022
  24. Johannes SchindelinAug 19, 2022
  25. Junio C HamanoAug 19, 2022
  26. Johannes SchindelinAug 22, 2022
  27. Junio C HamanoAug 22, 2022
  28. 4/4 po: adjust README to codeMichael J Gruber, Aug 18, 2022
  29. Ævar Arnfjörð BjarmasonAug 18, 2022
  30. Junio C HamanoAug 18, 2022
  31. 4/4 sequencer: spell out command names and do not translate themMichael J Gruber, Aug 19, 2022
  32. Johannes SchindelinAug 19, 2022
  33. Johannes SchindelinAug 19, 2022
  34. Michael J GruberAug 19, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.