Underscore `_` before the format string

前端 未结 3 593
刺人心
刺人心 2020-11-30 12:12

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

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

I

相关标签:
3条回答
  • 2020-11-30 12:50

    That would be from gettext

    0 讨论(0)
  • 2020-11-30 12:51

    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).

    0 讨论(0)
  • 2020-11-30 13:05

    It comes from gettext. Originally thought out, internationalization was too long to type each time 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.

    0 讨论(0)
提交回复
热议问题