]> git.ipfire.org Git - thirdparty/gettext.git/log
thirdparty/gettext.git
9 days agoits: Improve libxml error handling. master
Bruno Haible [Wed, 13 Aug 2025 20:19:19 +0000 (22:19 +0200)] 
its: Improve libxml error handling.

When there is a non-fatal error, the previous code would just print a message
to stderr and continue the operation, without affecting the exit code.

* gettext-tools/src/its.c: Include <setjmp.h>, <stdarg.h>.
(xml_error_exit): New variable.
(structured_error): Longjmp to xml_error_exit.
(generic_error): New function.
(its_rule_list_add_from_file, its_rule_list_add_from_string,
its_rule_list_extract, its_merge_context_merge, its_merge_context_alloc,
its_merge_context_write): Invoke also xmlSetGenericErrorFunc. Use setjmp to
abort the operation when a non-fatal error occurs.

11 days agoits: Fix error handling.
Bruno Haible [Mon, 11 Aug 2025 14:54:20 +0000 (16:54 +0200)] 
its: Fix error handling.

* gettext-tools/src/its.c (structured_error, its_rule_list_add_from_file,
its_rule_list_add_from_string, its_rule_list_extract, its_merge_context_alloc):
Swap error() arguments.

12 days agoRely more on Gnulib.
Bruno Haible [Sun, 10 Aug 2025 20:03:19 +0000 (22:03 +0200)] 
Rely more on Gnulib.

* gettext-tools/src/write-java.c (S_*): Remove macros, relying on gnulib module
sys_stat-h.
* gettext-tools/src/write-csharp.c (S_*): Likewise.

12 days agoUse standard way of including <config.h>.
Bruno Haible [Sun, 10 Aug 2025 15:34:20 +0000 (17:34 +0200)] 
Use standard way of including <config.h>.

* gettext-runtime/src/*.c: Include <config.h> unconditionally.
* gettext-runtime/libasprintf/lib-asprintf.h: Likewise.
* libtextstyle/lib/color.c: Likewise.
* gnulib-local/lib/markup.c: Likewise.
* gettext-tools/src/*.y: Likewise.
* gettext-tools/src/*.c: Likewise.
* gettext-tools/libgrep/*.c: Likewise.
* gettext-tools/libgettextpo/*.c: Likewise.
* gettext-tools/tests/*.c: Likewise.

2 weeks agoINSTALL: Tweak wording.
Bruno Haible [Tue, 5 Aug 2025 20:10:35 +0000 (22:10 +0200)] 
INSTALL: Tweak wording.

* INSTALL: Fix a copy-and-paste mistake.

2 weeks agobuild: Make autogen.sh more reliable.
Bruno Haible [Tue, 5 Aug 2025 20:09:01 +0000 (22:09 +0200)] 
build: Make autogen.sh more reliable.

* autogen.sh: Fail if gnulib-tool fails.

2 weeks agotests: Fix a lang-go failure.
Bruno Haible [Tue, 5 Aug 2025 06:35:42 +0000 (08:35 +0200)] 
tests: Fix a lang-go failure.

* gettext-tools/tests/lang-go: Add workaround against
"go: GOPROXY list is not the empty string, but contains no entries" error.

2 weeks agoUpdate after gnulib changed.
Bruno Haible [Mon, 4 Aug 2025 14:28:34 +0000 (16:28 +0200)] 
Update after gnulib changed.

* gettext-tools/tests/Makefile.am (TESTS_ENVIRONMENT): Define top_builddir,
consistently with Gnulib.
* gettext-tools/tests/init-env.in (top_builddir): Remove definition here.

2 weeks agoUpdate to the newest gnulib.
Bruno Haible [Mon, 4 Aug 2025 14:26:56 +0000 (16:26 +0200)] 
Update to the newest gnulib.

2 weeks agointl-java: Remove an unused variable.
Bruno Haible [Sun, 3 Aug 2025 18:11:40 +0000 (20:11 +0200)] 
intl-java: Remove an unused variable.

Reported by Coverity.

* gettext-runtime/intl-java/gnu/gettext/GettextResource.java (ngettextnull):
Remove an unused variable.

2 weeks agolibcroco: Fix double-free and free-after-use bug.
Bruno Haible [Sun, 3 Aug 2025 18:02:26 +0000 (20:02 +0200)] 
libcroco: Fix double-free and free-after-use bug.

Reported by Coverity.

* libtextstyle/gnulib-local/lib/libcroco/cr-sel-eng.c
(cr_sel_eng_unregister_pseudo_class_sel_handler): Don't access or free 'elem'
after it has been freed. Remove always-NULL variable.

2 weeks agointl: Fix a small memory leak.
Bruno Haible [Sun, 3 Aug 2025 17:34:19 +0000 (19:34 +0200)] 
intl: Fix a small memory leak.

Reported by Coverity.

* gettext-runtime/intl/loadmsgcat.c (_nl_load_domain): Free
sysdep_segment_values before 'goto invalid'.

2 weeks agoexamples: Fix a compiler warning.
Bruno Haible [Sun, 3 Aug 2025 17:33:22 +0000 (19:33 +0200)] 
examples: Fix a compiler warning.

* gettext-tools/examples/hello-objc-gnustep/Hello.m (Hello): Remove an unused
variable.

3 weeks agogettext.m4: Fix build on Cygwin with gcc 13 or newer.
Bruno Haible [Fri, 1 Aug 2025 13:17:31 +0000 (15:17 +0200)] 
gettext.m4: Fix build on Cygwin with gcc 13 or newer.

This gcc version links with -lintl -liconv by default, making it appear as if
gettext() et al. were defined in libc. But GNU gettext still needs to build a
new libintl.

* gettext-runtime/m4/gettext.m4 (AM_GNU_GETTEXT): On Cygwin, set
USE_INCLUDED_LIBINTL=yes regardless of the gcc version.

3 weeks agogettext.m4: Modernize.
Bruno Haible [Fri, 1 Aug 2025 13:03:45 +0000 (15:03 +0200)] 
gettext.m4: Modernize.

* gettext-runtime/m4/gettext.m4 (AM_GNU_GETTEXT): Rename configure option
--with-included-gettext to --with-included-libintl. Rename cache
variable nls_cv_force_use_gnu_gettext to gt_cv_force_use_gnu_libintl.
Rename cache variable nls_cv_use_gnu_gettext to gt_cv_use_gnu_libintl.

3 weeks agotests: Fix a lang-java failure on native Windows with MSVC.
Bruno Haible [Wed, 30 Jul 2025 14:22:32 +0000 (16:22 +0200)] 
tests: Fix a lang-java failure on native Windows with MSVC.

* gettext-tools/tests/lang-java: On native Windows, don't test the UTF-8 locale.

3 weeks agohostname: Fix a small memory leak.
Bruno Haible [Mon, 28 Jul 2025 14:08:40 +0000 (16:08 +0200)] 
hostname: Fix a small memory leak.

Reported by Coverity.

* gettext-tools/src/hostname.c (print_hostname): Free hostname before returning.

3 weeks agoFix a small memory leak.
Bruno Haible [Mon, 28 Jul 2025 14:01:40 +0000 (16:01 +0200)] 
Fix a small memory leak.

Reported by Coverity.

* gettext-tools/src/format-python.c (format_parse): Free name before returning.

3 weeks agoexamples: Add hello-ocaml example.
Bruno Haible [Mon, 28 Jul 2025 08:22:43 +0000 (10:22 +0200)] 
examples: Add hello-ocaml example.

* gettext-tools/examples/hello-ocaml/INSTALL: New file.
* gettext-tools/examples/hello-ocaml/autogen.sh: New file.
* gettext-tools/examples/hello-ocaml/autoclean.sh: New file.
* gettext-tools/examples/hello-ocaml/dune.in: New file.
* gettext-tools/examples/hello-ocaml/dune-project.in: New file.
* gettext-tools/examples/hello-ocaml/hello.ml.in: New file.
* gettext-tools/examples/hello-ocaml/Makefile.am: New file.
* gettext-tools/examples/hello-ocaml/configure.ac: New file.
* gettext-tools/examples/hello-ocaml/m4/Makefile.am: New file.
* gettext-tools/examples/hello-ocaml/po/LINGUAS: New file.
* gettext-tools/examples/hello-ocaml/po/Makefile.am: New file.
* gettext-tools/examples/Makefile.am (EXAMPLESFILES, EXAMPLESDIRS): Add
hello-ocaml.
* gettext-tools/examples/po/Makefile.am (POTFILES, SMALLPOTS): Update for
hello-ocaml.
(hello-ocaml.pot): New target.
(SMALLPOFILES_FOR_lang): Update for hello-ocaml.
($(srcdir)/../hello-ocaml/po/$(LL).po): New rule.
* gettext-tools/examples/check-examples (func_check__hello_ocaml): New function.
* gettext-tools/examples/README: Mention hello-ocaml.
* gettext-tools/doc/lang-ocaml.texi: Likewise.
* NEWS: Likewise.

3 weeks agoOCaml support: Add a unit test.
Bruno Haible [Mon, 28 Jul 2025 08:16:38 +0000 (10:16 +0200)] 
OCaml support: Add a unit test.

* gettext-tools/tests/lang-ocaml: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.
* HACKING: Document dependencies for lang-ocaml.

3 weeks agoOCaml support: Add OCaml support in the tools.
Bruno Haible [Sun, 27 Jul 2025 22:07:10 +0000 (00:07 +0200)] 
OCaml support: Add OCaml support in the tools.

This implements several improvements, compared to
"ocaml-gettext --action extract ...":
  - Comments are extracted.
  - '#, ocaml-format' annotation on f_ arguments.
  - Recognizes concatenated strings, such as ("abc" ^ "def").
  - Supports (s_ "").

* autopull.sh: Check out tree-sitter-ocaml. Set TREE_SITTER_OCAML_VERSION.
* gettext-tools/build-aux/tree-sitter-ocaml-portability.diff: New file.
* gettext-tools/configure.ac: Set TREE_SITTER_OCAML_VERSION.
* gettext-tools/Makefile.am (EXTRA_DIST): Add the tree-sitter-ocaml source code
and patch.
* gettext-tools/doc/gettext.texi (PO Files): Mention ocaml-format.
(Translators for other Languages): New subsection "OCaml Format Strings".
* gettext-tools/doc/lang-ocaml.texi: Mention all the supported *gettext
functions. Mention format strings with positions.
* gettext-tools/doc/xgettext.texi: Document the OCaml support in more places.
* gettext-tools/src/message.h (format_ocaml): New enum value.
(NFORMATS): Increment.
* gettext-tools/src/message.c (format_language, format_language_pretty): Add an
entry for format_ocaml.
* gettext-tools/src/format-ocaml.c: New file, based on
gettext-tools/src/format-awk.c.
* gettext-tools/src/format.h (formatstring_ocaml): New declaration.
* gettext-tools/src/format.c (formatstring_parsers): Add formatstring_ocaml.
* gettext-tools/src/x-ocaml.h (SCANNERS_OCAML): Reference flag_table_ocaml and
formatstring_ocaml.
(extract_ocaml): Declare with first argument of type 'FILE *'.
* gettext-tools/src/x-ocaml.c: Completely rewritten.
* gettext-tools/src/xgettext.c (flag_table_ocaml): New variable.
(usage): Document the OCaml support in more places.
(xgettext_record_flag): Support format_ocaml.
* gettext-tools/src/FILES: Mention format-ocaml.c.
* gettext-tools/src/Makefile.am (FORMAT_SOURCE): Add format-ocaml.c.
(LIBXGETTEXTTS): Add libxgettextts5.a.
(libxgettextts5_a_*): New variables.
* gettext-tools/libgettextpo/Makefile.am (libgettextpo_la_AUXSOURCES): Add
format-ocaml.c.
* gettext-tools/po/POTFILES.in: Add src/format-ocaml.c.
* gettext-tools/tests/format-ocaml-1: New file.
* gettext-tools/tests/format-ocaml-2: New file.
* gettext-tools/tests/xgettext-ocaml-1: New file.
* gettext-tools/tests/xgettext-ocaml-2: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add the new tests.
* NEWS: Mention the OCaml support.

3 weeks agoRefactor: Simplify.
Bruno Haible [Sun, 27 Jul 2025 07:47:12 +0000 (09:47 +0200)] 
Refactor: Simplify.

* gettext-tools/src/format-python-brace.c (parse_named_field,
parse_numeric_field, parse_directive, parse_upto): Remove 'translated'
parameter.
(format_parse): Update.

3 weeks agoFix typos in comments.
Bruno Haible [Sun, 27 Jul 2025 07:46:59 +0000 (09:46 +0200)] 
Fix typos in comments.

* gettext-tools/src/format-lua.c: Fix typos in comments.
* gettext-tools/src/format-d.c: Likewise.

4 weeks agoOCaml support: Add OCaml support in xgettext.
Bruno Haible [Wed, 23 Jul 2025 07:37:23 +0000 (09:37 +0200)] 
OCaml support: Add OCaml support in xgettext.

* gettext-tools/doc/lang-ocaml.texi: New file.
* gettext-tools/doc/Makefile.am (gettext_TEXINFOS): Add it.
* gettext-tools/doc/gettext.texi (No string concatenation): Mention string
concatenation in OCaml.
(List of Programming Languages): Include lang-ocaml.texi.
* gettext-tools/doc/xgettext.texi: Document the -L OCaml option.
* gettext-tools/src/x-ocaml.h: New file.
* gettext-tools/src/x-ocaml.c: New file.
* gettext-tools/src/xgettext.c: Include x-ocaml.h.
(flag_table_ocaml): New variable.
(main): Invoke init_flag_table_ocaml, x_ocaml_extract_all, x_ocaml_keyword.
(usage): Document the -L OCaml option.
(language_to_extractor, extension_to_language): Support OCaml.
* gettext-tools/src/FILES: Mention x-ocaml.h, x-ocaml.c.
* gettext-tools/src/Makefile.am (noinst_HEADERS): Add x-ocaml.h.
(xgettext_SOURCES): Add x-ocaml.c.
* gettext-tools/po/POTFILES.in: Add src/x-ocaml.c.

4 weeks agotests: Fix a lang-java failure on native Windows.
Bruno Haible [Tue, 22 Jul 2025 10:40:35 +0000 (12:40 +0200)] 
tests: Fix a lang-java failure on native Windows.

* gettext-tools/tests/lang-java: On native Windows, convert newlines in the
output before comparing.

4 weeks agotests: Recognize the *-*-windows* config triplets introduced on 2023-06-26.
Bruno Haible [Tue, 22 Jul 2025 10:37:42 +0000 (12:37 +0200)] 
tests: Recognize the *-*-windows* config triplets introduced on 2023-06-26.

* gettext-tools/tests/init-env.in: Treat windows* as equivalent to mingw*.
* gettext-tools/tests/intl-7: Likewise.
* gettext-tools/tests/lang-c: Likewise.
* gettext-tools/tests/lang-c++: Likewise.
* gettext-tools/tests/lang-c++-boost: Likewise.
* gettext-tools/tests/lang-c++20: Likewise.
* gettext-tools/tests/lang-c++26: Likewise.
* gettext-tools/tests/lang-d: Likewise.
* gettext-tools/tests/lang-modula2: Likewise.
* gettext-tools/tests/lang-objc: Likewise.
* gettext-tools/tests/msgfilter-8: Likewise.

4 weeks agotests: Fix a lang-java failure on native Windows.
Bruno Haible [Mon, 21 Jul 2025 19:18:33 +0000 (21:18 +0200)] 
tests: Fix a lang-java failure on native Windows.

* gettext-tools/tests/init-env.in (CLASSPATH_SEPARATOR): New variable.
* gettext-tools/tests/lang-java: Use it instead of hardcoding ':'.

4 weeks agoFix typos.
Bruno Haible [Mon, 21 Jul 2025 13:31:01 +0000 (15:31 +0200)] 
Fix typos.

Reported by <Jens.Schleusener@fossies.org>.

* gettext-tools/libgrep/m-regex.c: Fix typo in comments.
* gettext-tools/misc/autopoint.in: Likewise.
* gettext-tools/misc/gettextize.in: Likewise.
* gettext-tools/src/format-python-brace.c: Likewise.
* gettext-tools/src/gnu/gettext/DumpResource.java: Likewise.
* gettext-tools/src/its.h: Likewise.
* gettext-tools/src/locating-rules.h: Likewise.
* gettext-tools/src/msgmerge.c: Likewise.
* gettext-tools/src/read-catalog-abstract.h: Likewise.
* gettext-tools/src/read-catalog-abstract.c: Likewise.
* gettext-tools/src/read-catalog.h: Likewise.
* gettext-tools/src/read-properties.c: Likewise.
* gettext-tools/src/write-java.c: Likewise.
* gettext-tools/src/write-mo.c: Likewise.
* gettext-tools/src/x-d.c: Likewise.
* gettext-tools/src/x-scheme.c: Likewise.
* gettext-tools/src/x-sh.c: Likewise.
* gettext-tools/emacs/po-mode.el: Fix typos in help and comments.
* gettext-tools/doc/gettext.texi: Fix typos.
* NEWS: Fix typos.

4 weeks agoexamples: Reenable checking of hello-c-gnome3 and hello-c++-gnome3.
Bruno Haible [Mon, 21 Jul 2025 20:06:25 +0000 (22:06 +0200)] 
examples: Reenable checking of hello-c-gnome3 and hello-c++-gnome3.

* gettext-tools/examples/check-examples (func_check__hello_c_gnome3,
func_check__hello_cxx_gnome3): Reenable most checks.

4 weeks agoexamples: Make 'check-example' more maintainable.
Bruno Haible [Sun, 20 Jul 2025 15:56:37 +0000 (17:56 +0200)] 
examples: Make 'check-example' more maintainable.

Some examples require specific sets of environment variables.
E.g. hello-go requires a PATH which uses GCC 13 or 14, not GCC 15,
due to <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119098>.

* gettext-tools/examples/check-examples: Rewrite to use one top-level function
per sample, instead of one top-level function for each check.

4 weeks agoRelease 0.26 v0.26
Bruno Haible [Sat, 19 Jul 2025 20:23:05 +0000 (22:23 +0200)] 
Release 0.26

4 weeks agoUpdate release steps.
Bruno Haible [Sat, 19 Jul 2025 19:52:47 +0000 (21:52 +0200)] 
Update release steps.

4 weeks agoexamples: Use infrastructure from gettext version 0.26.
Bruno Haible [Sat, 19 Jul 2025 16:10:30 +0000 (18:10 +0200)] 
examples: Use infrastructure from gettext version 0.26.

* gettext-tools/examples/hello-*/configure.ac: Use AM_GNU_GETTEXT_VERSION with
version 0.26.
* gettext-tools/examples/hello-c++-kde/configure.in.in: Likewise.

4 weeks agoUpdate translations from TP.
Bruno Haible [Sat, 19 Jul 2025 15:19:37 +0000 (17:19 +0200)] 
Update translations from TP.

* gettext-runtime/po/*.po: Update from TP.
* gettext-tools/po/*.po: Update from TP.
* gettext-tools/examples/po/*.po: Update from TP.

4 weeks agoPrepare for 0.26 release.
Bruno Haible [Sat, 19 Jul 2025 15:08:04 +0000 (17:08 +0200)] 
Prepare for 0.26 release.

* gettext-runtime/doc/matrix.texi: Update from TP.
* gettext-runtime/doc/nls.texi (STATUS): Update.
* gettext-runtime/intl/libgnuintl.in.h (LIBINTL_VERSION): Bump.
* libtextstyle/version.sh: Update VERSION_NUMBER, RELEASE_DATE.
* gettext-tools/libgettextpo/gettext-po.in.h (LIBGETTEXTPO_VERSION): Bump.
* gettext-runtime/po/Makefile.in.in: Update Origin.
* gettext-runtime/intl/Makefile.am (LTV_*): Bump to 12:5:4.
* libtextstyle/lib/Makefile.am (LTV_*): Bump to 2:6:2.
* gettext-tools/libgettextpo/Makefile.am (LTV_*): Bump to 5:15:5.
* gettext-tools/misc/autopoint.in: Likewise. Accept version 0.26.
* gettext-tools/configure.ac (ARCHIVE_VERSION): Bump to 0.26.

4 weeks agoUpdate to the newest gnulib.
Bruno Haible [Sat, 19 Jul 2025 14:17:39 +0000 (16:17 +0200)] 
Update to the newest gnulib.

4 weeks agoxgettext: JavaScript: Add one more test.
Bruno Haible [Sat, 19 Jul 2025 06:30:02 +0000 (08:30 +0200)] 
xgettext: JavaScript: Add one more test.

Reported by <fiurgeist@gmail.com>
at <https://savannah.gnu.org/bugs/index.php?67337>.

* gettext-tools/tests/xgettext-javascript-14: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.

5 weeks agomsginit: Fix encoding of second title line, part 2.
Bruno Haible [Fri, 18 Jul 2025 19:38:32 +0000 (21:38 +0200)] 
msginit: Fix encoding of second title line, part 2.

Reported by Matilin Torre <watilin@protonmail.com> in
<https://lists.gnu.org/archive/html/bug-gettext/2025-07/msg00024.html>.

To reproduce the problem:
$ LC_ALL=de_DE.ISO-8859-1 msginit -l fr_FR.ISO-8859-1 -i some_utf-8.pot -o fr.po

* gettext-tools/src/msginit.c (output_charset): New variable.
(content_type): Use output_charset.
(get_title): Use output_charset instead of ignoring was_utf8.
(fill_header): Initialize output_charset. Moved logic from content_type()
to here.

5 weeks agomsginit: Fix encoding of second title line, part 1.
Bruno Haible [Fri, 18 Jul 2025 19:34:55 +0000 (21:34 +0200)] 
msginit: Fix encoding of second title line, part 1.

Reported by Matilin Torre <watilin@protonmail.com> in
<https://lists.gnu.org/archive/html/bug-gettext/2025-07/msg00024.html>.

* gettext-tools/src/msginit.c: Include xstriconv.h.
(get_title): Don't set OUTPUT_CHARSET; this does not work any more since 2005,
when an optimization was made in dcigettext.c. Instead, use xstr_iconv().

5 weeks agomsgfmt: Verify that .mo files are reproducible across GNU gettext versions.
Bruno Haible [Sat, 12 Jul 2025 12:38:33 +0000 (14:38 +0200)] 
msgfmt: Verify that .mo files are reproducible across GNU gettext versions.

* gettext-tools/tests/msgfmt-21: New file.
* gettext-tools/tests/testdata/mf-21.mo: New generated file.
* gettext-tools/tests/Makefile.am (TESTS): Add msgfmt-21.
(EXTRA_DIST): Add testdata/mf-21.mo.

5 weeks agoUpdate to the newest gnulib.
Bruno Haible [Sat, 12 Jul 2025 12:38:01 +0000 (14:38 +0200)] 
Update to the newest gnulib.

6 weeks agobuild: On mingw, avoid link dependency from xgettext.exe to libstdc++.
Bruno Haible [Wed, 9 Jul 2025 06:02:21 +0000 (08:02 +0200)] 
build: On mingw, avoid link dependency from xgettext.exe to libstdc++.

Reported by Michele Locati <michele@locati.it> in
<https://lists.gnu.org/archive/html/bug-gettext/2024-10/msg00007.html>.

* gettext-tools/src/Makefile.am (xgettext_CXXFLAGS): New variable.

6 weeks agobuild: Use a more understandable directory name for ITS data files.
Bruno Haible [Wed, 9 Jul 2025 06:12:43 +0000 (08:12 +0200)] 
build: Use a more understandable directory name for ITS data files.

Reported by Santiago Vila <sanvila@debian.org>.

* gettext-tools/configure.ac (PACKAGE_SUFFIX): Use PACKAGE_VERSION, not
ARCHIVE_VERSION.

6 weeks agobuild: Update .gitignore files.
Bruno Haible [Tue, 8 Jul 2025 14:05:22 +0000 (16:05 +0200)] 
build: Update .gitignore files.

6 weeks agobuild: Remove autosprintf_all.html upon "make maintainer-clean".
Bruno Haible [Tue, 8 Jul 2025 10:06:29 +0000 (12:06 +0200)] 
build: Remove autosprintf_all.html upon "make maintainer-clean".

* gettext-runtime/libasprintf/Makefile.am (MAINTAINERCLEANFILES): New variable.

6 weeks agotests: Fix suggested valgrind invocation.
Bruno Haible [Mon, 7 Jul 2025 07:17:58 +0000 (09:17 +0200)] 
tests: Fix suggested valgrind invocation.

A while ago, valgrind exited with exit code != 0 when it encountered an error.
This is apparently not the case any more.

* gettext-tools/tests/Makefile.am (CHECKER): Add --error-exitcode option.

6 weeks agoxgettext: Perl: Add unit test for bug.
Bruno Haible [Mon, 7 Jul 2025 07:16:01 +0000 (09:16 +0200)] 
xgettext: Perl: Add unit test for bug.

* gettext-tools/tests/xgettext-perl-11: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.

6 weeks agoxgettext: Perl: Fix a memory leak (regression 2003-06-27).
Bruno Haible [Mon, 7 Jul 2025 07:03:18 +0000 (09:03 +0200)] 
xgettext: Perl: Fix a memory leak (regression 2003-06-27).

* gettext-tools/src/x-perl.c (phase2_getc): Free the result of
from_current_source_encoding.

6 weeks agoxgettext: Perl: Fix bug with comment lines longer than 1024 (regr. 2024-09-26).
Bruno Haible [Mon, 7 Jul 2025 07:02:41 +0000 (09:02 +0200)] 
xgettext: Perl: Fix bug with comment lines longer than 1024 (regr. 2024-09-26).

Reported by Alyssa Ross <hi@alyssa.is> in
<https://lists.gnu.org/archive/html/bug-gettext/2025-07/msg00009.html>.

* gettext-tools/src/x-perl.c (phase2_getc): Move the sb_free call until after
the savable_comment_add call.

7 weeks agodoc: More precisions about POSIX printf portability.
Bruno Haible [Fri, 4 Jul 2025 08:26:09 +0000 (10:26 +0200)] 
doc: More precisions about POSIX printf portability.

* gettext-tools/doc/lang-sh.texi (The printf approach): Add more details.
Based on info given by Jörg Schilling in 2020.

7 weeks agoPrepare for prerelease.
Bruno Haible [Fri, 4 Jul 2025 06:49:38 +0000 (08:49 +0200)] 
Prepare for prerelease.

* gettext-tools/po/POTFILES.in: Update file list.

7 weeks agoUpdate to the newest gnulib.
Bruno Haible [Fri, 4 Jul 2025 06:36:28 +0000 (08:36 +0200)] 
Update to the newest gnulib.

7 weeks agoxgettext: Warn when a message contains an URL or email address.
Bruno Haible [Fri, 4 Jul 2025 02:00:23 +0000 (04:00 +0200)] 
xgettext: Warn when a message contains an URL or email address.

Reported by Arsen Arsenović <arsen@aarsen.me>
at <https://savannah.gnu.org/bugs/?67000>.

* gettext-tools/src/xg-check.c: Include c-strstr.h.
(SIZEOF): New macro.
(string_has_url, message_has_url, string_has_email, message_has_email,
url_check_message): New functions.
(xgettext_check_message_list): Invoke url_check_message.
* gettext-tools/tests/xgettext-20: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.
* NEWS: Mention the change.

7 weeks agomsgcat, msgen, xgettext: Tweak processing order.
Bruno Haible [Thu, 3 Jul 2025 16:56:11 +0000 (18:56 +0200)] 
msgcat, msgen, xgettext: Tweak processing order.

* gettext-tools/src/msgcat.c (main): Sort the list of messages as the last
processing step before writing the PO file.
* gettext-tools/src/msgen.c (main): Likewise.
* gettext-tools/src/xgettext.c (main): Likewise.

7 weeks agoxgettext: Check msgid and msgid_plural for compatibility as format strings.
Bruno Haible [Thu, 3 Jul 2025 14:56:01 +0000 (16:56 +0200)] 
xgettext: Check msgid and msgid_plural for compatibility as format strings.

* gettext-tools/src/if-error.h: Include <stdarg.h>.
(if_verror): New declaration.
* gettext-tools/src/if-error.c (if_verror): New function, extracted from
if_error.
(if_error): Invoke it.
* gettext-tools/src/xg-check.h (xgettext_check_message_list): Renamed from
syntax_check_message_list.
* gettext-tools/src/xg-check.c: Include format.h, if-error.h.
(struct formatstring_error_logger_locals): New type.
(formatstring_error_logger, format_check_message): New functions.
(xgettext_check_message_list): Renamed from syntax_check_message_list. Invoke
also format_check_message.
* gettext-tools/src/xgettext.c (main): Invoke xgettext_check_message_list
instead of syntax_check_message_list.
* gettext-tools/tests/xgettext-19: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.
* NEWS: Mention the change.

7 weeks agoLisp, Scheme support: Fix format string checking.
Bruno Haible [Thu, 3 Jul 2025 14:30:39 +0000 (16:30 +0200)] 
Lisp, Scheme support: Fix format string checking.

* gettext-tools/src/format-lisp.c (format_check): Allow missing arguments if
!equality.
* gettext-tools/src/format-scheme.c (format_check): Likewise.

7 weeks agoLua support: Fix format string checking.
Bruno Haible [Thu, 3 Jul 2025 14:14:48 +0000 (16:14 +0200)] 
Lua support: Fix format string checking.

* gettext-tools/src/format-lua.c (format_check): Allow missing arguments if
!equality. Report all argument type mismatches at once.

7 weeks agotests: Strengthen tests.
Bruno Haible [Thu, 3 Jul 2025 14:04:40 +0000 (16:04 +0200)] 
tests: Strengthen tests.

* gettext-tools/tests/lang-bash: Invoke msgfmt with option '-c'.
* gettext-tools/tests/lang-c: Likewise.
* gettext-tools/tests/lang-c++: Likewise.
* gettext-tools/tests/lang-c++20: Likewise.
* gettext-tools/tests/lang-c++26: Likewise.
* gettext-tools/tests/lang-c++-boost: Likewise.
* gettext-tools/tests/lang-clisp: Likewise.
* gettext-tools/tests/lang-csharp: Likewise.
* gettext-tools/tests/lang-d: Likewise.
* gettext-tools/tests/lang-elisp: Likewise.
* gettext-tools/tests/lang-gawk: Likewise.
* gettext-tools/tests/lang-go: Likewise.
* gettext-tools/tests/lang-guile: Likewise.
* gettext-tools/tests/lang-java: Likewise.
* gettext-tools/tests/lang-javascript: Likewise.
* gettext-tools/tests/lang-librep: Likewise.
* gettext-tools/tests/lang-lua: Likewise.
* gettext-tools/tests/lang-modula2: Likewise.
* gettext-tools/tests/lang-objc: Likewise.
* gettext-tools/tests/lang-pascal: Likewise.
* gettext-tools/tests/lang-perl-1: Likewise.
* gettext-tools/tests/lang-perl-2: Likewise.
* gettext-tools/tests/lang-php: Likewise.
* gettext-tools/tests/lang-python-1: Likewise.
* gettext-tools/tests/lang-python-2: Likewise.
* gettext-tools/tests/lang-ruby: Likewise.
* gettext-tools/tests/lang-rust: Likewise.
* gettext-tools/tests/lang-sh-1: Likewise.
* gettext-tools/tests/lang-sh-2: Likewise.
* gettext-tools/tests/lang-sh-3: Likewise.
* gettext-tools/tests/lang-smalltalk: Likewise.
* gettext-tools/tests/lang-tcl: Likewise.
* gettext-tools/tests/lang-vala: Likewise.

7 weeks agoPython: Fix compilation error (regression 2025-06-24).
Bruno Haible [Thu, 3 Jul 2025 10:42:13 +0000 (12:42 +0200)] 
Python: Fix compilation error (regression 2025-06-24).

* gettext-tools/src/format-python-brace.c (parse_directive): Pass NULL, not
false.

7 weeks agoModula-2 support: Fix possible crash during format string checking.
Bruno Haible [Thu, 3 Jul 2025 13:47:02 +0000 (15:47 +0200)] 
Modula-2 support: Fix possible crash during format string checking.

* gettext-tools/src/format-modula2.c (format_check): Fix error message. Fix loop
bound.

7 weeks agoxgettext: Fix bug with syntax-checks on messages from Perl source code.
Bruno Haible [Thu, 3 Jul 2025 10:50:15 +0000 (12:50 +0200)] 
xgettext: Fix bug with syntax-checks on messages from Perl source code.

* gettext-tools/src/x-perl.c (extract_perl): Don't free logical_file_name,
because it is referenced by the 'pos' field of the returned messages, and
xg-check.c accesses and prints it.

7 weeks agoxgettext: Fix handling of syntax-checks with multi-domain POT files.
Bruno Haible [Thu, 3 Jul 2025 09:19:38 +0000 (11:19 +0200)] 
xgettext: Fix handling of syntax-checks with multi-domain POT files.

* gettext-tools/src/xgettext.c (main): Consider the total number of errors.

7 weeks agomsggrep: Add new options -W and -S.
Bruno Haible [Thu, 3 Jul 2025 06:48:44 +0000 (08:48 +0200)] 
msggrep: Add new options -W and -S.

Reported at <https://savannah.gnu.org/bugs/?40489>.

* gettext-tools/src/msggrep.c (workflow_flags, sticky_flags): New variables.
(main): Initialize them. Handle the options -W and -S.
(usage): Document the -W and -S options.
(is_message_selected_no_invert): Return true if one of the specified workflow
flags or one of the specified sticky flags is set.
* gettext-tools/tests/msggrep-12: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.
* gettext-tools/doc/msggrep.texi: Document the -W and -S options.
* NEWS: Mention the change.

7 weeks agomsggrep: Finish documenting the -X option (left-over from 2006-03-17).
Bruno Haible [Thu, 3 Jul 2025 05:55:01 +0000 (07:55 +0200)] 
msggrep: Finish documenting the -X option (left-over from 2006-03-17).

* gettext-tools/doc/msggrep.texi: Mention the -X option in the summary.

7 weeks agoUpdate NEWS after 0.25.1 release.
Bruno Haible [Wed, 2 Jul 2025 01:50:58 +0000 (03:50 +0200)] 
Update NEWS after 0.25.1 release.

* NEWS: Mention 0.25.1 release.

7 weeks agoMerge from 0.25.x branch: Prepare for 0.25.1 release.
Bruno Haible [Tue, 1 Jul 2025 23:12:21 +0000 (01:12 +0200)] 
Merge from 0.25.x branch: Prepare for 0.25.1 release.

* gettext-tools/misc/autopoint.in: Accept versions 0.23.2, 0.24.2, 0.25.1.
* gettext-tools/configure.ac (ARCHIVE_VERSION): Bump to 0.25.1.
* NEWS: Update.

7 weeks agoautopoint: Don't fail if no gettext version is specified, part 2.
Bruno Haible [Tue, 1 Jul 2025 20:12:13 +0000 (22:12 +0200)] 
autopoint: Don't fail if no gettext version is specified, part 2.

* gettext-tools/misc/autopoint.in (func_trace_sed): Recognize also macro calls
without arguments.
* gettext-tools/tests/autopoint-1: Remove unneeded parentheses in macro call.

7 weeks agoautopoint: Update unit test, part 2.
Bruno Haible [Tue, 1 Jul 2025 14:56:10 +0000 (16:56 +0200)] 
autopoint: Update unit test, part 2.

* gettext-tools/tests/autopoint-1: Remove debugging trace.

7 weeks agoautopoint: Update unit test.
Bruno Haible [Tue, 1 Jul 2025 14:50:52 +0000 (16:50 +0200)] 
autopoint: Update unit test.

* gettext-tools/tests/autopoint-1: Update for new autopoint behaviour.

7 weeks agoFix an autoreconf failure in packages that only need AM_NLS.
Bruno Haible [Tue, 1 Jul 2025 12:27:37 +0000 (14:27 +0200)] 
Fix an autoreconf failure in packages that only need AM_NLS.

Rationale: https://lists.gnu.org/archive/html/bug-gettext/2025-06/msg00009.html

* gettext-tools/m4/Makefile.am (aclocaldir, aclocal_DATA): New variables.
* PACKAGING: Update.

7 weeks agoautopoint: Don't fail if no gettext version is specified.
Bruno Haible [Tue, 1 Jul 2025 13:00:27 +0000 (15:00 +0200)] 
autopoint: Don't fail if no gettext version is specified.

Rationale: https://lists.gnu.org/archive/html/bug-gettext/2025-06/msg00009.html

* gettext-tools/misc/autopoint.in: Instead of failing with "Missing version",
use version 0.23.1. Set omitintl=yes if there is no AM_GNU_GETTEXT invocation.

7 weeks agoSupport reading PO files with '#=' lines.
Bruno Haible [Mon, 30 Jun 2025 11:50:51 +0000 (13:50 +0200)] 
Support reading PO files with '#=' lines.

* gettext-tools/src/read-catalog-abstract.c
(catalog_reader_seen_generic_comment): Treat '=' like ','.
* gettext-tools/src/read-catalog.c (default_comment_special): Allow several
calls to this method to make side effects on dcatr.
* gettext-tools/src/read-catalog-special.h: Update comment.
* gettext-tools/src/read-catalog-special.c: Likewise.
* gettext-tools/tests/msgcat-24: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.

7 weeks agodoc: Document the short-term PO file format evolution.
Bruno Haible [Mon, 30 Jun 2025 11:50:43 +0000 (13:50 +0200)] 
doc: Document the short-term PO file format evolution.

* gettext-tools/doc/gettext.texi (PO File Format Evolution): New section.

7 weeks agodoc: Structure the "PO Files" chapter.
Bruno Haible [Mon, 30 Jun 2025 11:50:39 +0000 (13:50 +0200)] 
doc: Structure the "PO Files" chapter.

* gettext-tools/doc (PO Files): Split into sections. Introduce workflow flags
and sticky flags. Mention the 'no-wrap' flag.

7 weeks agoSimplify code: The syntax-check flags are only used inside xgettext.
Bruno Haible [Mon, 30 Jun 2025 11:49:13 +0000 (13:49 +0200)] 
Simplify code: The syntax-check flags are only used inside xgettext.

* gettext-tools/src/message.h: Improve comments regarding do_syntax_check.
* gettext-tools/src/msgl-cat.c (catenate_msgdomain_list): Don't manipulate
do_syntax_check field.
* gettext-tools/src/msgmerge.c (message_merge): Likewise.
* gettext-tools/src/read-catalog-special.h (parse_comment_special): Change 'scp'
parameter to a pointer.
* gettext-tools/src/read-catalog-special.c (parse_comment_special): Support a
null 'scp' argument.
* gettext-tools/src/read-catalog.h (DEFAULT_CATALOG_READER_TY): Remove
do_syntax_check field.
* gettext-tools/src/read-catalog.c (default_constructor,
default_copy_comment_state, default_reset_comment_state,
default_comment_special): Don't reference do_syntax_check field.

7 weeks agoexamples: Extend the hello-sh example, part 2.
Bruno Haible [Sun, 29 Jun 2025 07:08:45 +0000 (09:08 +0200)] 
examples: Extend the hello-sh example, part 2.

* gettext-tools/examples/hello-sh/hello-2.sh: New file, based on
gettext-tools/examples/hello-sh/hello-1.sh.
* gettext-tools/examples/hello-sh/hello-3.sh: New file, based on
gettext-tools/examples/hello-sh/hello-2.sh.

7 weeks agoTweak last commit.
Bruno Haible [Sat, 28 Jun 2025 22:15:04 +0000 (00:15 +0200)] 
Tweak last commit.

* gettext-tools/src/msgcmp.c (main): Tweak whitespace.

7 weeks agoRefactor: Use gnulib's 'options' module.
Bruno Haible [Sat, 28 Jun 2025 21:48:03 +0000 (23:48 +0200)] 
Refactor: Use gnulib's 'options' module.

* autogen.sh (GNULIB_MODULES_RUNTIME_FOR_SRC, GNULIB_MODULES_TOOLS_FOR_SRC): Add
'options'. Remove 'getopt-gnu'.
* gettext-runtime/src/envsubst.c: Include options.h instead of <getopt.h>.
(long_options): Remove variable.
(main): Define options array here. Call start_options, get_next_option instead
of getopt_long().
* gettext-runtime/src/gettext.c: Likewise.
* gettext-runtime/src/ngettext.c: Likewise.
* gettext-runtime/src/printf_gettext.c: Likewise.
* gettext-runtime/src/printf_ngettext.c: Likewise.
* gettext-tools/src/cldr-plurals.c: Likewise.
* gettext-tools/src/hostname.c: Likewise.
* gettext-tools/src/msgattrib.c: Likewise.
* gettext-tools/src/msgcat.c: Likewise.
* gettext-tools/src/msgcmp.c: Likewise.
* gettext-tools/src/msgcomm.c: Likewise.
* gettext-tools/src/msgconv.c: Likewise.
* gettext-tools/src/msgen.c: Likewise.
* gettext-tools/src/msgexec.c: Likewise.
* gettext-tools/src/msgfilter.c: Likewise.
* gettext-tools/src/msgfmt.c: Likewise.
* gettext-tools/src/msggrep.c: Likewise.
* gettext-tools/src/msginit.c: Likewise.
* gettext-tools/src/msgmerge.c: Likewise.
* gettext-tools/src/msgunfmt.c: Likewise.
* gettext-tools/src/msguniq.c: Likewise.
* gettext-tools/src/recode-sr-latin.c: Likewise.
* gettext-tools/src/urlget.c: Likewise.
* gettext-tools/src/xgettext.c: Likewise.
* gettext-tools/tests/tstgettext.c: Likewise.
* gettext-tools/tests/tstngettext.c: Likewise.

7 weeks agoUpdate to the newest gnulib.
Bruno Haible [Sat, 28 Jun 2025 21:40:06 +0000 (23:40 +0200)] 
Update to the newest gnulib.

7 weeks agoAdhere to GNU Coding Style.
Bruno Haible [Sat, 28 Jun 2025 21:38:03 +0000 (23:38 +0200)] 
Adhere to GNU Coding Style.

* gettext-runtime/src/envsubst.c (main): Use common 'switch' indentation.
* gettext-tools/src/hostname.c (main): Likewise.
* gettext-tools/src/recode-sr-latin.c (main): Likewise.
* gettext-tools/src/urlget.c (main): Likewise.
* gettext-tools/tests/tstgettext.c (main): Likewise.
* gettext-tools/tests/tstngettext.c (main): Likewise.

7 weeks agoxgettext: Remove undocumented no-op option '-W'.
Bruno Haible [Sat, 28 Jun 2025 08:19:51 +0000 (10:19 +0200)] 
xgettext: Remove undocumented no-op option '-W'.

This was a regression from 2015-01-29.

* gettext-tools/src/xgettext.c (main): Remove short option '-W'.

7 weeks agomsgconv, msgen, msgfilter, msggrep, msgmerge: The option '-n' takes no argument.
Bruno Haible [Sat, 28 Jun 2025 00:12:58 +0000 (02:12 +0200)] 
msgconv, msgen, msgfilter, msggrep, msgmerge: The option '-n' takes no argument.

This was a regression from 2014-03-24.

* gettext-tools/src/msgconv.c (main): Change "n:" to "n" in getopt_long
argument.
* gettext-tools/src/msgen.c (main): Likewise.
* gettext-tools/src/msgfilter.c (main): Likewise.
* gettext-tools/src/msggrep.c (main): Likewise.
* gettext-tools/src/msgmerge.c (main): Likewise.

8 weeks agoShell: Document two more approaches.
Bruno Haible [Fri, 27 Jun 2025 21:19:00 +0000 (23:19 +0200)] 
Shell: Document two more approaches.

* gettext-tools/doc/lang-sh.texi (sh): Tweaks.
(sh - Three approaches): New subsubsection.
(The gettext.sh approach): New subsubsection, incorporating the "gettext.sh"
subsubsection.
(The printf approach, The printf_gettext approach): New subsubsections.
(Preparing for gettext.sh): Renamed from "Preparing Shell Scripts".
(Preparing for printf, Preparing for printf_gettext): New subsubsections.
* gettext-tools/doc/gettext.texi: Update detailed node list.
* NEWS: Mention the change.

8 weeks agoexamples: Extend the hello-sh example.
Bruno Haible [Fri, 27 Jun 2025 21:18:54 +0000 (23:18 +0200)] 
examples: Extend the hello-sh example.

* gettext-tools/examples/hello-sh/hello-1.sh: Renamed from
gettext-tools/examples/hello-sh/hello.sh.
* gettext-tools/examples/hello-sh/hello-2.sh: New file, based on
gettext-tools/examples/hello-sh/hello-1.sh.
* gettext-tools/examples/hello-sh/hello-3.sh: New file, based on
gettext-tools/examples/hello-sh/hello-2.sh.
* gettext-tools/examples/hello-sh/configure.ac: Update AC_CONFIG_SRCDIR
invocation and AC_CONFIG_FILES invocations.
* gettext-tools/examples/hello-sh/Makefile.am (bin_SCRIPTS): Remove hello.
Add hello-1, hello-2, hello-3.
* gettext-tools/examples/hello-sh/po/Makefile.am (POTFILES): Remove hello.sh.
Add hello-1.sh, hello-2.sh, hello-3.sh.
* gettext-tools/examples/po/Makefile.am (POTFILES): Update accordingly.
* gettext-tools/examples/Makefile.am (EXAMPLESFILES): Update file list.

8 weeks agoShell: Add another unit test.
Bruno Haible [Fri, 27 Jun 2025 21:18:50 +0000 (23:18 +0200)] 
Shell: Add another unit test.

* gettext-tools/tests/lang-sh-3: New file, based on
gettext-tools/tests/lang-sh-2.
* gettext-tools/tests/Makefile.am (TESTS): Add it.

8 weeks agobuild: Use module 'kwset' from gnulib.
Bruno Haible [Thu, 26 Jun 2025 20:15:27 +0000 (22:15 +0200)] 
build: Use module 'kwset' from gnulib.

* autogen.sh (GNULIB_MODULES_TOOLS_FOR_LIBGREP): Add kwset.
(GNULIB_MODULES_TOOLS_FOR_SRC_COMMON_DEPENDENCIES): Update.
* gettext-tools/libgrep/m-fgrep.c (Fcompile, Fexecute): Update for changed kwset
API.
* gettext-tools/libgrep/kwset.h: Remove file.
* gettext-tools/libgrep/kwset.c: Remove file.
* gettext-tools/libgrep/Makefile.am (libgrep_a_SOURCES): Remove kwset.h,
kwset.c.

8 weeks agoUpdate to the newest gnulib.
Bruno Haible [Thu, 26 Jun 2025 20:05:41 +0000 (22:05 +0200)] 
Update to the newest gnulib.

8 weeks agobuild: Update regarding current gnulib.
Bruno Haible [Thu, 26 Jun 2025 19:40:01 +0000 (21:40 +0200)] 
build: Update regarding current gnulib.

* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC_COMMON_DEPENDENCIES): Update.

8 weeks agobuild: Fix "make distcheck" failure.
Bruno Haible [Wed, 25 Jun 2025 04:56:21 +0000 (06:56 +0200)] 
build: Fix "make distcheck" failure.

* gettext-runtime/man/*.x: Add copyright and license header.

8 weeks agoxgettext: Shell: Recognize printf_gettext, printf_ngettext invocations.
Bruno Haible [Wed, 25 Jun 2025 02:16:09 +0000 (04:16 +0200)] 
xgettext: Shell: Recognize printf_gettext, printf_ngettext invocations.

* gettext-tools/src/x-sh.c (init_keywords, init_flag_table_sh): Add knowledge
about printf_gettext and printf_ngettext.
(read_command): Recognize '-c' option of printf_gettext and printf_ngettext.
* gettext-tools/tests/xgettext-sh-1: Add test cases with printf_gettext and
printf_ngettext.
* gettext-tools/doc/xgettext.texi: Document it.

8 weeks agogettext-runtime: New programs 'printf_gettext', 'printf_ngettext'.
Bruno Haible [Wed, 25 Jun 2025 02:16:03 +0000 (04:16 +0200)] 
gettext-runtime: New programs 'printf_gettext', 'printf_ngettext'.

* autogen.sh (GNULIB_MODULES_RUNTIME_FOR_SRC): Add c-ctype, c-strtold,
fzprintf-posix, mbrtoc32, mbszero, quote, stdint-h, strtoimax, strtold,
strtoumax, xstrtold.
* gettext-runtime/src/printf-command.h: New file.
* gettext-runtime/src/printf-command.c: New file.
* gettext-runtime/src/printf_gettext.c: New file.
* gettext-runtime/src/Makefile.am (bin_PROGRAMS): Add printf_gettext,
printf_ngettext.
(noinst_LIBRARIES, libgrtsrc_a_SOURCES): New variables.
(printf_gettext_SOURCES, printf_gettext_CFLAGS, printf_gettext_LDFLAGS): New
variables.
(printf_ngettext_SOURCES, printf_ngettext_CFLAGS, printf_ngettext_LDFLAGS): New
variables.
(LDADD): Add libgrtsrc.a.
* gettext-runtime/po/POTFILES.in: Add src/printf-command.c,
src/printf_gettext.c, src/printf_ngettext.c.
* gettext-runtime/man/printf_gettext.x: New file.
* gettext-runtime/man/printf_ngettext.x: New file.
* gettext-runtime/man/Makefile.am (man_aux): Add printf_gettext.x,
printf_ngettext.x.
(man_MAN1GEN): Add printf_gettext.1, printf_ngettext.1.
(man_MAN1IN): Add printf_gettext.1.in, printf_ngettext.1.in.
(man_HTML1GEN): Add printf_gettext.1.html, printf_ngettext.1.html.
(man_HTML1IN): Add printf_gettext.1.html.in, printf_ngettext.1.html.in.
(printf_gettext.1, rintf_ngettext.1, printf_gettext.1.in, printf_ngettext.1.in):
Add dependencies.
(printf_gettext.1.html, printf_ngettext.1.html, printf_gettext.1.html.in,
printf_ngettext.1.html.in): Likewise.
* gettext-runtime/Makefile.am (distdir1): Depend on man/printf_gettext.1 and
man/printf_ngettext.1.
(man/printf_gettext.1, man/printf_ngettext.1): Depend on gen-man1.
(gen-man1): Make src/printf_gettext, src/printf_ngettext and printf_gettext.1,
printf_ngettext.1.
* gettext-runtime/doc/rt-printf_gettext.texi: New file.
* gettext-runtime/doc/rt-printf_ngettext.texi: New file.
* gettext-runtime/doc/Makefile.am (EXTRA_DIST): Add them.
* gettext-tools/doc/lang-sh.texi (printf_gettext Invocation,
printf_ngettext Invocation): New subsubsections.
* gettext-tools/doc/gettext.texi (@direntry): Add printf_gettext, .
* gettext-tools/doc/Makefile.am (gettext_TEXINFOS): Add rt-printf_gettext.texi,
rt-printf_ngettext.texi.
* gettext-runtime/NEWS: Mention the new programs.
* NEWS: Likewise.
* PACKAGING: Add the printf_gettext and printf_ngettext programs and their
documentation.

8 weeks agogettext-runtime: Improve --help output.
Bruno Haible [Wed, 25 Jun 2025 02:15:58 +0000 (04:15 +0200)] 
gettext-runtime: Improve --help output.

* gettext-runtime/src/gettext.c (usage): Add section title
"Options and arguments".
* gettext-runtime/src/ngettext.c (usage): Likewise.
* gettext-runtime/doc/rt-gettext.texi: Add section titles
"Options and arguments" and "Informative output".
* gettext-runtime/doc/rt-ngettext.texi: Likewise.

8 weeks agoC++: Add another unit test.
Bruno Haible [Tue, 24 Jun 2025 10:28:21 +0000 (12:28 +0200)] 
C++: Add another unit test.

* gettext-tools/tests/lang-c++-boost: New file, based on
gettext-tools/tests/lang-c++26.
* gettext-tools/tests/Makefile.am (TESTS): Add it.
* gettext-tools/doc/lang-c.texi: Mention how to use C++ with the Boost library.
* HACKING: Mention the Boost library.

8 weeks agoShell: Add another unit test.
Bruno Haible [Tue, 24 Jun 2025 05:23:56 +0000 (07:23 +0200)] 
Shell: Add another unit test.

* gettext-tools/tests/lang-sh-1: Renamed from gettext-tools/tests/lang-sh.
* gettext-tools/tests/lang-sh-2: New file, based on
gettext-tools/tests/lang-sh-1.
* gettext-tools/tests/Makefile.am (TESTS): Remove lang-sh. Add lang-sh-1,
lang-sh-2.

8 weeks agoPython: Add another unit test.
Bruno Haible [Tue, 24 Jun 2025 09:26:42 +0000 (11:26 +0200)] 
Python: Add another unit test.

* gettext-tools/tests/lang-python-2: New file, based on
gettext-tools/tests/lang-python-1.
* gettext-tools/tests/Makefile.am (TESTS): Add it.

8 weeks agoPython: Update python-brace-format, assuming Python >= 3.1.
Bruno Haible [Tue, 24 Jun 2025 09:24:55 +0000 (11:24 +0200)] 
Python: Update python-brace-format, assuming Python >= 3.1.

* gettext-tools/src/format-python-brace.c (struct toplevel_counters): New type.
(parse_directive): Take a 'struct toplevel_counters *' parameter. Allow empty
argument names at the top-level. But reject format strings with both absolute
argument numbers and unnamed arguments at the top-level.
(parse_upto): Take a 'struct toplevel_counters *' parameter.
(format_parse): Pass a 'struct toplevel_counters *' to parse_upto.
* gettext-tools/tests/format-python-brace-1: Update.
* gettext-tools/tests/format-python-brace-2: Add another test case.
* gettext-tools/doc/lang-python.texi: Add more examples of formatting with
positions.

8 weeks agoPython: Fix bug in python-brace-format.
Bruno Haible [Tue, 24 Jun 2025 09:15:46 +0000 (11:15 +0200)] 
Python: Fix bug in python-brace-format.

* gettext-tools/src/format-python-brace.c (parse_directive): The name ends
before ':', not before '}'.

8 weeks agoPython: Remove an obsolete unit test.
Bruno Haible [Tue, 24 Jun 2025 07:59:20 +0000 (09:59 +0200)] 
Python: Remove an obsolete unit test.

Python versions < 2.3 are irrelevant nowadays.

* gettext-tools/tests/lang-python-1: Renamed from
gettext-tools/tests/lang-python-2.
* gettext-tools/tests/Makefile.am (TESTS): Remove lang-python-2.

8 weeks agoSupport format strings longer than 2 GiB on 64-bit platforms.
Bruno Haible [Mon, 23 Jun 2025 19:20:46 +0000 (21:20 +0200)] 
Support format strings longer than 2 GiB on 64-bit platforms.

* gettext-tools/configure.ac: In config.h, define GCD_WORD_T.
* gettext-tools/src/format-invalid.h: In format strings, use %zu instead of %u.
* gettext-tools/src/format-awk.c: Use size_t instead of 'unsigned int'. In
format strings, use %zu instead of %u.
* gettext-tools/src/format-boost.c: Likewise.
* gettext-tools/src/format-c.c: Likewise.
* gettext-tools/src/format-c-parse.h: Likewise.
* gettext-tools/src/format-c++-brace.c: Likewise.
* gettext-tools/src/format-csharp.c: Likewise.
* gettext-tools/src/format-d.c: Likewise.
* gettext-tools/src/format-elisp.c: Likewise.
* gettext-tools/src/format-gcc-internal.c: Likewise.
* gettext-tools/src/format-gfc-internal.c: Likewise.
* gettext-tools/src/format-go.c: Likewise.
* gettext-tools/src/format-java.c: Likewise.
* gettext-tools/src/format-java-printf.c: Likewise.
* gettext-tools/src/format-javascript.c: Likewise.
* gettext-tools/src/format-kde.c: Likewise.
* gettext-tools/src/format-kde-kuit.c: Likewise.
* gettext-tools/src/format-librep.c: Likewise.
* gettext-tools/src/format-lisp.c: Likewise.
* gettext-tools/src/format-lua.c: Likewise.
* gettext-tools/src/format-modula2.c: Likewise.
* gettext-tools/src/format-pascal.c: Likewise.
* gettext-tools/src/format-perl.c: Likewise.
* gettext-tools/src/format-perl-brace.c: Likewise.
* gettext-tools/src/format-php.c: Likewise.
* gettext-tools/src/format-python.c: Likewise.
* gettext-tools/src/format-python-brace.c: Likewise.
* gettext-tools/src/format-qt.c: Likewise.
* gettext-tools/src/format-qt-plural.c: Likewise.
* gettext-tools/src/format-ruby.c: Likewise.
* gettext-tools/src/format-rust.c: Likewise.
* gettext-tools/src/format-scheme.c: Likewise.
* gettext-tools/src/format-sh.c: Likewise.
* gettext-tools/src/format-sh-printf.c: Likewise.
* gettext-tools/src/format-smalltalk.c: Likewise.
* gettext-tools/src/format-tcl.c: Likewise.
* gettext-tools/src/format.h (get_python_format_unnamed_arg_count): Return
size_t instead of 'unsigned int'.

8 weeks agoUpdate to the newest gnulib.
Bruno Haible [Mon, 23 Jun 2025 19:20:23 +0000 (21:20 +0200)] 
Update to the newest gnulib.