tags:

views:

123

answers:

3

I'm here watcing at some C source code and I've found this:

fprintf(stderr, _("Try `%s --help' for more information.\n"), command);

I already saw the underscore when I had a look at wxWidget, and I read it's used for internationalization. I found it really horrible (the least intutive name ever), but I tought it's just another weird wxWidget convention.

Now I find it again in some Alsa source... anyone knows where it comes from?

+9  A: 

That would be from gettext

Dennis Haarbrink
+3  A: 

It comes from gettext. Originally thought out, internationalization ws too long to type each type you needed a string internationalized. So programmers created the shortcut i18n (because there are 18 letters in between the 'i' and the 'n' in internationalization) and you may see source code out there using that. Apparently though i18n was still too long, so now its just an underscore.

icemanind
+1 for sarcasm and mocking gettext.
R..
The function's name is not `i18n`, but `gettext` though...
Hasturkun
+2  A: 

It comes from GNU gettext, a package designed to ease the internationalization process. The _() function is simply a string wrapper. This function basically replaces the given string on runtime with a translation in the system's language, if available (i.e. if they shipped a .mo file for this language with the program).

RWS