我在这里查看一些C源代码,发现了这一点:
I'm here looking at some C source code and I've found this:
fprintf(stderr, _("Try `%s --help' for more information.\n"), command);当我看一下wxWidget时,我已经看到了下划线,并且我读到它是用于国际化的.我发现它真的很可怕(有史以来最不直观的名称),但我坚信这只是另一个怪异的wxWidget约定.
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.
现在,我在某些Alsa来源中再次找到了它.有人知道它来自哪里吗?
Now I find it again in some Alsa source. Does anyone know where it comes from?
推荐答案它来自GNU gettext,这是一个旨在简化国际化过程的软件包. _()函数只是一个字符串包装器.此功能基本上在运行时将给定的字符串替换为系统语言的译文(如果有的话)(即如果他们在程序中附带了该语言的.mo文件).
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).
更多推荐
在格式字符串前加下划线
发布评论