Re: [RFC/PATCH] sequencer: do not translate reflog messages
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Aug 15, 2022, 20:20 UTC
- Message-ID
- <92sr80s2-6311-p065-755s-61s28s543q6n@tzk.qr>
- In-Reply-To
- <xmqqy1vt9ora.fsf@gitster.g>
Hi Junio,
On Fri, 12 Aug 2022, Junio C Hamano wrote:
Show 9 quoted lines
> 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)));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