Query for unfamiliar printf syntax

In the source code of the fdisk command for Unix, I came across the following printf.

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

      

Why are lines placed in parentheses preceded by an underscore?

+3


source to share


1 answer


Shorthand for gettext

:

#define _(string) gettext (string)

      

1.1 Purpose of GNU gettext



Typically, programs are written and documented in English and use English at run time to interact with users. This is true not only of GNU software, but also of many proprietary and free software. Using a common language is great for communication between developers, maintainers, and users from all countries. On the other hand, most people are less comfortable with English than with their native language, and would prefer to use their native language whenever possible to work during the day. Many would just love to see their computer screen showing a lot less English, and a lot more of their language.

However, for many people, this dream may seem so reassuring that they may believe that it is not even worth spending time thinking about it. They are not confident that the dream can become true. However, some of them did not lose hope and organized themselves. The translation project is the formalization of this hope into a workable framework that has a good chance of bringing us all closer to achieving a truly multilingual set of programs.

GNU gettext is an important step for a translation project as it is an asset on which we can build many other steps. This package offers programmers, translators and even users a well-integrated set of tools and documentation. In particular, the GNU gettext utilities are a collection of tools that provide a framework in which other free packages can create multilingual messages.

Additional Information

+2


source







All Articles