问题
What's the role of the _("hello, world\n") argument to printf/puts etc ? I often find it while reading GNU source code.
回答1:
See GNU Gettext -- it (_(...)
) is used as a "binding site" for translation.
回答2:
This is the gettext internationalization system.
回答3:
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
回答4:
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.
来源:https://stackoverflow.com/questions/4299669/what-does-printf-hello-world-n-mean