manpagez: man pages & more
info gettext
Home | html | info | man

File: gettext.info,  Node: printf_ngettext Invocation,  Next: envsubst Invocation,  Prev: printf_gettext Invocation,  Up: sh

16.5.15.11 Invoking the ‘printf_ngettext’ program
.................................................

     printf_ngettext [OPTION] FORMAT FORMAT-PLURAL COUNT [ARGUMENT]...

   The ‘printf_ngettext’ program produces formatted output, applying the
native language translation of FORMAT and FORMAT-PLURAL, depending on
COUNT, to the ARGUMENTs.

*Options and arguments*

‘-c CONTEXT’
‘--context=CONTEXT’
     Specify the context for the format string to be translated.  See
     *note Contexts:: for details.

‘FORMAT’
     English singular form of format string.

‘FORMAT-PLURAL’
     English plural form of format string.

‘COUNT’
     A cardinal number.  The singular/plural form is chosen based on
     this value.

‘ARGUMENT’
     A string or numeric argument.

*Informative output*

‘-h’
‘--help’
     Display this help and exit.

‘-V’
‘--version’
     Output version information and exit.

   Each format string consists of
   • plain text,
   • directives, that start with ‘%’,
   • escape sequences, that start with a backslash.

   A directive that consumes an argument
   • starts with ‘%’ or ‘%M$’ where M is a positive integer,
   • is optionally followed by any of the characters ‘#’, ‘0’, ‘-’, ‘ ’,
     ‘+’, each of which acts as a flag,
   • is optionally followed by a width specification (a nonnegative
     integer),
   • is optionally followed by ‘.’ and a precision specification (an
     optional nonnegative integer),
   • is finished by a specifier
        • ‘c’, that prints a character,
        • ‘s’, that prints a string,
        • ‘i’, ‘d’, that print an integer,
        • ‘u’, ‘o’, ‘x’, ‘X’, that print an unsigned (nonnegative)
          integer,
        • ‘e’, ‘E’, that print a floating-point number in scientific
          notation,
        • ‘f’, ‘F’, that print a floating-point number without an
          exponent,
        • ‘g’, ‘G’, that print a floating-point number in general
          notation,
        • ‘a’, ‘A’, that print a floating-point number in hexadecimal
          notation.

   Some flag+specifier combinations are invalid:
   • The ‘#’ flag with the specifiers ‘c’, ‘s’, ‘i’, ‘d’, ‘u’.
   • The ‘0’ flag with the specifiers ‘c’, ‘s’.

   Additionally there is the directive ‘%%’, that prints a single ‘%’.

   If a directive specifies the argument by its number (‘%M$’ notation),
all directives that consume an argument must do so.

   The escape sequences are:
‘\\’
     backslash
‘\a’
     alert (BEL)
‘\b’
     backspace (BS)
‘\f’
     form feed (FF)
‘\n’
     new line (LF)
‘\r’
     carriage return (CR)
‘\t’
     horizontal tab (HT)
‘\v’
     vertical tab (VT)
‘\NNN’
     octal number with 1 to 3 octal digits

*Environment Variables*

   The translation of the format string is looked up in the translation
domain given by the environment variable ‘TEXTDOMAIN’.

   It is looked up in the catalogs directory given by the environment
variable ‘TEXTDOMAINDIR’ or, if not present, in the default catalogs
directory.

© manpagez.com 2000-2026
Individual documents may contain additional copyright information.