Subject: Re: [PATCH 01/72] gettext.h: add no-op _() and N_() wrappers

From: Jonathan Nieder <[email-masked]>
Date: Sun, 20 Feb 2011 04:34:58 -0600

Erik Faye-Lund wrote:
> On Sun, Feb 20, 2011 at 3:01 AM, Jonathan Nieder <[email-masked]> wrote:
>> Ævar Arnfjörð Bjarmason wrote:

>>> +#define N_(s) (s)
>>
>> Might be nice to make this an inline function, for type safety.
>>
>>> +#define _(s) (s)
>>
>> This one can't be a function, though, since it needs to transform
>> literals to literals.
[...]
>> +/* Mark msgid for translation but do not translate it. */
>> +#define N_(msgid) (msgid)
>
> Isn't this the opposite of what you suggested above?

Agh.  I mixed up the snippets from Ævar’s message.

N_ needs to take literals to literals, so even the non-stub version would
be defined as

	#define N_(msgid) (msgid)

for use in contexts like

	const char *unpack_plumbing_errors[NB_UNPACK_TREES_ERROR_TYPES] = {
		/* ERROR_WOULD_OVERWRITE */
		N_("Entry '%s' would be overwritten by merge. Cannot merge."),

		/* ERROR_NOT_UPTODATE_FILE */
		N_("Entry '%s' not uptodate. Cannot merge."),
	[...]

Meanwhile, in the non-stub version, _ is a synonym for the gettext()
function.

Sorry for the noise.
Jonathan