21.07.2015 Views

GAWK: Effective AWK Programming

GAWK: Effective AWK Programming

GAWK: Effective AWK Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

162 <strong>G<strong>AWK</strong></strong>: <strong>Effective</strong> <strong>AWK</strong> <strong>Programming</strong>LC_NUMERICNumeric information, such as which characters to use for the decimal point andthe thousands separator. 2LC_RESPONSEResponse information, such as how “yes” and “no” appear in the local language,and possibly other information as well.LC_TIMELC_ALLTime- and date-related information, such as 12- or 24-hour clock, month printedbefore or after day in a date, local month abbreviations, and so on.All of the above. (Not too useful in the context of gettext.)9.3 Internationalizing awk Programsgawk provides the following variables and functions for internationalization:TEXTDOMAINThis variable indicates the application’s text domain. For compatibility withGNU gettext, the default value is "messages"._"your message here"String constants marked with a leading underscore are candidates for translationat runtime. String constants without a leading underscore are not translated.dcgettext(string [, domain [, category]])This built-in function returns the translation of string in text domain domainfor locale category category. The default value for domain is the current valueof TEXTDOMAIN. The default value for category is "LC_MESSAGES".If you supply a value for category, it must be a string equal to one of the knownlocale categories described in the previous section. You must also supply a textdomain. Use TEXTDOMAIN if you want to use the current domain.Caution: The order of arguments to the awk version of the dcgettext functionis purposely different from the order for the C version. The awk version’s orderwas chosen to be simple and to allow for reasonable awk-style default arguments.dcngettext(string1, string2, number [, domain [, category]])This built-in function returns the plural form used for number of the translationof string1 and string2 in text domain domain for locale category category.string1 is the English singular variant of a message, and string2 the Englishplural variant of the same message. The default value for domain is the currentvalue of TEXTDOMAIN. The default value for category is "LC_MESSAGES".The same remarks as for the dcgettext function apply.bindtextdomain(directory [, domain])This built-in function allows you to specify the directory in which gettext looksfor ‘.mo’ files, in case they will not or cannot be placed in the standard locations(e.g., during testing). It returns the directory in which domain is “bound.”2 Americans use a comma every three decimal places and a period for the decimal point, while manyEuropeans do exactly the opposite: 1,234.56 versus 1.234,56.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!