]> git.ipfire.org Git - thirdparty/gettext.git/commit
Add support for translation lookup with context in shell scripts.
authorBruno Haible <bruno@clisp.org>
Sat, 15 Sep 2018 20:54:24 +0000 (22:54 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 15 Sep 2018 21:01:11 +0000 (23:01 +0200)
commite43fde63ea6fcdd88113ba903ffbc774d39e57f6
tree13e851f30f29f2eda68d808329ee16d7cbce27b5
parentb26729c67cffb2403d8a20b44606f5a08cb901b5
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.
12 files changed:
NEWS
gettext-runtime/doc/rt-gettext.texi
gettext-runtime/doc/rt-ngettext.texi
gettext-runtime/src/gettext.c
gettext-runtime/src/gettext.sh.in
gettext-runtime/src/ngettext.c
gettext-tools/doc/gettext.texi
gettext-tools/doc/xgettext.texi
gettext-tools/src/x-sh.c
gettext-tools/src/xgettext.c
gettext-tools/src/xgettext.h
gettext-tools/tests/lang-sh