Add support for translation lookup with context in shell scripts.
Reported by Markus Gothe <nietzsche@lysator.liu.se>
in <https://savannah.gnu.org/bugs/?49899>.
* gettext-runtime/src/gettext.c (long_options): Add option '--context'.
(main): Handle option -c/--context.
(usage): Document option -c/--context. Split usage message.
* gettext-runtime/src/ngettext.c (long_options): Add option '--context'.
(main): Handle option -c/--context.
(usage): Document option -c/--context. Split usage message.
* gettext-runtime/src/gettext.sh.in (eval_pgettext, eval_npgettext): New
functions.
* gettext-tools/src/xgettext.h (struct arglist_parser): Add 'next_is_msgctxt'
field.
(arglist_parser_remember_msgctxt): New declaration.
* gettext-tools/src/xgettext.c (arglist_parser_alloc, arglist_parser_clone):
Update accordingly.
(arglist_parser_remember_msgctxt): New function.
* gettext-tools/src/x-sh.c (init_keywords): Recognize also eval_pgettext and
eval_npgettext.
(init_flag_table_sh): Set flags for eval_pgettext, eval_npgettext.
(substring_of_word): New function.
(read_command): Recognize and handle -c/--context argument of 'gettext' and
'ngettext'.
* gettext-tools/tests/lang-sh: Add test of message lookup with context.
* gettext-runtime/doc/rt-gettext.texi: Mention the --context option.
* gettext-runtime/doc/rt-ngettext.texi: Likewise.
* gettext-tools/doc/gettext.texi (sh, Preparing Shell Scripts, gettext.sh):
Mention the new shell functions.
(eval_pgettext Invocation, eval_npgettext Invocation): New subsubsections.
* gettext-tools/doc/xgettext.texi: Mention the support for eval_pgettext,
eval_npgettext.
* NEWS: Mention the changes.