Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   gawk    ( 1 )

язык сканирования и обработки шаблонов (pattern scanning and processing language)

INTERNATIONALIZATION

String constants are sequences of characters enclosed in double
       quotes.  In non-English speaking environments, it is possible to
       mark strings in the AWK program as requiring translation to the
       local natural language. Such strings are marked in the AWK
       program with a leading underscore ('_').  For example,

gawk 'BEGIN { print "hello, world" }'

always prints hello, world. But,

gawk 'BEGIN { print _"hello, world" }'

might print bonjour, monde in France.

There are several steps involved in producing and running a localizable AWK program.

1. Add a BEGIN action to assign a value to the TEXTDOMAIN variable to set the text domain to a name associated with your program:

BEGIN { TEXTDOMAIN = "myprog" }

This allows gawk to find the .gmo file associated with your program. Without this step, gawk uses the messages text domain, which likely does not contain translations for your program.

2. Mark all strings that should be translated with leading underscores.

3. If necessary, use the dcgettext() and/or bindtextdomain() functions in your program, as appropriate.

4. Run gawk --gen-pot -f myprog.awk > myprog.pot to generate a .pot file for your program.

5. Provide appropriate translations, and build and install the corresponding .gmo files.

The internationalization features are described in full detail in GAWK: Effective AWK Programming.