What does printf (_("hello, world\n")) mean? [duplicate]
What's the role of the _("hello, world\n") argument to printf/puts etc ? I often find it while reading GNU source code.
See GNU Gettext -- it (_(...)
) is used as a "binding site" for translation.
This is the gettext internationalization system.
it is a macro that replaces the gettext translation function. For a thorough explanation on gettext, check out this write-up: http://oriya.sarovar.org/docs/gettext_single.html
The underscore function (or macro) is a custom function defined by whatever project you're looking at. By convention, it's defined to send the string to GNU Gettext to fetch a translated version of the string for the user's current language.
This use of the _
macro is documented in the overview found in the GNU Gettext manual.
精彩评论