Thread (113 messages) flat view 113 messages, 3 authors, 2016-06-15

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

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:50:37

Erik Faye-Lund wrote:
On Sun, Feb 20, 2011 at 3:01 AM, Jonathan Nieder [off-list ref] wrote:
quoted
Ævar Arnfjörð Bjarmason wrote:
quoted
quoted
+#define N_(s) (s)
Might be nice to make this an inline function, for type safety.
quoted
+#define _(s) (s)
This one can't be a function, though, since it needs to transform
literals to literals.
[...]
quoted
+/* 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help