在格式字符串前加下划线

编程入门 行业动态 更新时间:2024-10-17 13:38:56
本文介绍了在格式字符串前加下划线_的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在这里查看一些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).

更多推荐

在格式字符串前加下划线

本文发布于:2023-07-18 12:48:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1144923.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:下划线   字符串   格式

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!