Re: [PATCH v2 1/2] object.[ch]: mark object type names for translation
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 7, 2021, 18:06 UTC
- Message-ID
- <xmqq35pcr9oc.fsf@gitster.g>
- In-Reply-To
- <YV4JQytrc9UTa22o@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 22 quoted lines
> On Wed, Oct 06, 2021 at 12:46:12PM -0700, Junio C Hamano wrote:
>
>> Jeff King <peff@peff.net> writes:
>>
>> > They all appear to want is as a noun. So maybe this is just
>> > mis-translated for Spanish. It does feel like an accident in the making,
>> > though.
>>
>> Probably we need pgettext().
>>
>> https://www.gnu.org/software/gettext/manual/html_node/Contexts.html
>
> Yeah, that make sense. I'm not sure how it interacts with N_(), though.
> I.e., I'd expect the "context" to ride along with the original string,
> but I guess it is really in the caller who's translating it. So the real
> spot becomes:
>
> printf(_("my type is %s"), pgettext("object-type", type_name(type)));
>
> It's a little unfortunate that every caller has to do it rather than
> putting it near the source string. But I guess a type_name_human() would
> solve that, too. ;)Yes, I agree the need for pgettext() is annoying but I do not see an easy alternative. Introducing a wrapper like type_name_human() to limit the damage sounds like the best we could do.
Thanks.