Re: [PATCH 01/72] gettext.h: add no-op _() and N_() wrappers
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Feb 20, 2011, 10:34 UTC
- Message-ID
- <20110220103458.GB9340@elie>
- In-Reply-To
- <AANLkTikkTUD=ih_KHxZ-F2gm_rNTfJ0E3Z6WXSLHBCnd@mail.gmail.com>
Erik Faye-Lund wrote:
> On Sun, Feb 20, 2011 at 3:01 AM, Jonathan Nieder <jrnieder@gmail.com> wrote: >> Ævar Arnfjörð Bjarmason wrote:
Show 8 quoted lines
>>> +#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