gpt4 book ai didi

c - 查询一个不熟悉的printf函数语法

转载 作者:行者123 更新时间:2023-12-02 01:46:48 25 4
gpt4 key购买 nike

在 Unix fdisk 命令的源代码中,我遇到了以下 printf。

printf ("%s %s %10s %11s %11s %4s %7s ", _("Device"),
_("Boot"), _("Start"), _("End"), _("Blocks"), _("Id"), _("System"));

为什么要将字符串放在括号内,并在前面加上下划线?

最佳答案

gettext的简写:

#define _(string) gettext (string)

1.1 GNU gettext 的目的

Usually, programs are written and documented in English, and use English at execution time to interact with users. This is true not only of GNU software, but also of a great deal of proprietary and free software. Using a common language is quite handy for communication between developers, maintainers and users from all countries. On the other hand, most people are less comfortable with English than with their own native language, and would prefer to use their mother tongue for day to day’s work, as far as possible. Many would simply love to see their computer screen showing a lot less of English, and far more of their own language.

However, to many people, this dream might appear so far fetched that they may believe it is not even worth spending time thinking about it. They have no confidence at all that the dream might ever become true. Yet some have not lost hope, and have organized themselves. The Translation Project is a formalization of this hope into a workable structure, which has a good chance to get all of us nearer the achievement of a truly multi-lingual set of programs.

GNU gettext is an important step for the Translation Project, as it is an asset on which we may build many other steps. This package offers to programmers, translators and even users, a well integrated set of tools and documentation. Specifically, the GNU gettext utilities are a set of tools that provides a framework within which other free packages may produce multi-lingual messages.

More info

关于c - 查询一个不熟悉的printf函数语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25155239/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com