What does printf (_(“hello, world\n”)) mean? [duplicate]

*爱你&永不变心* 提交于 2020-01-20 08:06:32

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!