bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gettext] Recognition of C++11 literal operator


From: Jan Engelhardt
Subject: [bug-gettext] Recognition of C++11 literal operator
Date: Mon, 17 Feb 2014 16:53:50 +0100 (CET)
User-agent: Alpine 2.11 (LSU 23 2013-08-11)

Section 15.5.1 of gettext(-0.18.3.1)'s documentation (gettext.info)
has to say in summary:

        String syntax
             ‘"abc"’
        gettext shorthand
             ‘_("abc")’

The C++2011 literal operator provides an interesting stylistic way
of invoking a function on a string without having to use parentheses.
For example:

#include <cstdio>
#include <libintl.h>
static const char *operator"" _tl(const char *s, size_t)
{
        return gettext(s);
}
int main(void)
{
        printf("Hello world\n"_tl);
        return 0;
}

It does not look like xgettext has a way to specify the suffix
and extract the string, short of using the -a option. (RFE)

Additionally, xgettext stumbles upon the operator"" keyword itself (as a 
result of -a), which does not mean what xgettext thinks it means:

stl.cpp:3: warning: Empty msgid.  It is reserved by GNU gettext:
                    gettext("") returns the header entry with
                    meta information, not the empty string.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]