GETTEXT(1) General Commands Manual GETTEXT(1)

gettext
message translation front-end

gettext [-h]

gettext [-en] [textdomain] msgid

gettext -s [-n] [msgid ...]

gettext attempts to translate a given msgid into the locale-specific string as determined by the environment. If a translation file is not found, or a translation for the given msgid is not found, the original string will be echoed.

If the textdomain is not provided as an argument, the TEXTDOMAIN environment variable will be consulted instead.

By default gettext will look for message catalogs in /usr/share/locale. If the environment variable TEXTDOMAINDIR is defined, then that will override the default location.

The following flags are available:

Interpret backslash escape sequences prior to translation.
Print the usage information
If -s is used, do not add the trailing newline. If -s is not provided, this flag will do nothing.
Act similarly to echo(1). All msgid arguments will be translated, and a newline will be appended to the output string.

The domain to use when looking up msgids.
The location of message catalogs to use, overriding /usr/share/locale.

The gettext utility exits 0 on success, and >0 if an error occurs.

$ LANG=es gettext grep 'writing output'
escribiendo el resultado

echo(1), gettext(3), environ(7)
June 3, 2015 NetBSD 9.4