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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dscho

On 15/08/2022 21:20, Johannes Schindelin wrote:
Hi Junio,

On Fri, 12 Aug 2022, Junio C Hamano wrote:

Phillip Wood <phillip.wood123@xxxxxxxxx> 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

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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux