Bruno Haible [Fri, 2 May 2025 15:02:17 +0000 (17:02 +0200)]
xgettext: Give a hint about --no-git when max_vc_mtime() took more than 10 sec.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add getrusage.
* gettext-tools/src/xgettext.c: Include <sys/resource.h>.
(max_mtime): New function.
(finalize_header): Invoke it.
Bruno Haible [Fri, 2 May 2025 14:06:45 +0000 (16:06 +0200)]
xgettext: Add an option to opt-out of the use of git for the POT-Creation-Date.
Reported by Serhii Tereshchenko at <https://savannah.gnu.org/bugs/?66865>.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add stat-time.
* gettext-tools/src/xgettext.c: Include stat-time.h.
(xgettext_no_git): New variable.
(long_options): Add option '--no-git'.
(main): Handle the option --no-git.
(usage): Document the option --no-git.
(struct accumulator): New type, copied from gnulib/lib/vc-mtime.c.
(accumulate): New function, copied from gnulib/lib/vc-mtime.c.
(max_mtime_without_git): New function, based on gnulib/lib/vc-mtime.c.
(finalize_header): Conditionally invoke max_mtime_without_git instead of
max_vc_mtime.
* gettext-tools/doc/xgettext.texi: Document the option --no-git.
* NEWS: Mention the change.
Bruno Haible [Thu, 24 Apr 2025 14:15:24 +0000 (16:15 +0200)]
Update after gnulib changed.
* gettext-runtime/intl/setlocale.c: Include setlocale-fixes.h instead of
setlocale-messages.h.
(setlocale_unixlike) [__ANDROID__]: Use setlocale_fixed instead of setlocale.
(setlocale_improved): On Android, use setlocale_fixed_null instead of setlocale.
Bruno Haible [Tue, 1 Apr 2025 14:16:18 +0000 (16:16 +0200)]
gettextize: Fix bad interactions between autoreconf and autopoint.
Reported by Sebastian Pipping <sebastian@pipping.org>
in <https://savannah.gnu.org/bugs/index.php?66968>.
* gettext-tools/m4/Makefile.am (aclocaldir): Remove variable.
(pkgdatadir, macrosdir): Add variables.
(macros_DATA): Renamed from aclocal_DATA.
(install-data-local, uninstall-local, uninstall-macros): New targets.
* gettext-tools/misc/gettextize.in: Copy the *.m4 files from
$datadir/gettext/m4, not from $datadir/aclocal.
* gettext-tools/doc/gettext.texi (aclocal): Don't recommend to add option
--install to ACLOCAL_MFLAGS. Instead, recommend one-time use of --system-acdir.
* PACKAGING: Expect *.m4 files in $prefix/share/gettext/m4, not in
$prefix/share/aclocal.
* NEWS: Mention the fix.
Bruno Haible [Tue, 25 Feb 2025 12:41:30 +0000 (13:41 +0100)]
examples: Use infrastructure from gettext version 0.24.
* gettext-tools/examples/hello-*/configure.ac: Use AM_GNU_GETTEXT_VERSION with
version 0.24.
* gettext-tools/examples/hello-c++-kde/configure.in.in: Likewise.
Bruno Haible [Wed, 12 Feb 2025 09:54:08 +0000 (10:54 +0100)]
examples: Add hello-c-http example.
* gettext-tools/examples/hello-c-http/INSTALL: New file.
* gettext-tools/examples/hello-c-http/autogen.sh: New file, based on
gettext-tools/examples/hello-c/autogen.sh.
* gettext-tools/examples/hello-c-http/autoclean.sh: New file, based on
gettext-tools/examples/hello-c/autoclean.sh.
* gettext-tools/examples/hello-c-http/hello-server.c: New file.
* gettext-tools/examples/hello-c-http/Makefile.am: New file, based on
gettext-tools/examples/hello-c/Makefile.am.
* gettext-tools/examples/hello-c-http/configure.ac: New file, based on
gettext-tools/examples/hello-c/configure.ac.
* gettext-tools/examples/hello-c-http/m4/Makefile.am: New file, copied from
gettext-tools/examples/hello-c/m4/Makefile.am.
* gettext-tools/examples/hello-c-http/po/POTFILES.in: New file.
* gettext-tools/examples/hello-c-http/po/Makevars: New file, copied from
gettext-tools/examples/hello-c/po/Makevars.
* gettext-tools/examples/hello-c-http/po/LINGUAS: New file, copied from
gettext-tools/examples/hello-c/po/LINGUAS.
* gettext-tools/examples/Makefile.am (EXAMPLESFILES, EXAMPLESDIRS): Add
hello-c-http.
* gettext-tools/examples/po/Makefile.am (POTFILES, SMALLPOTS): Update for
hello-c-http.
(hello-c-http.pot): New target.
(SMALLPOFILES_FOR_lang): Update for hello-c-http.
($(srcdir)/../hello-c-http/po/$(LL).po): New rule.
* gettext-tools/examples/check-examples (func_check_autoclean_all,
func_check_distclean_all, func_check_maintainerclean_all,
func_check_maintainerclean_vpath_all, func_check_dist_all,
func_check_dist_vpath_all, func_check_install_all, func_check_uninstall_all,
func_check_distcheck_all, func_check_all): Handle hello-c-http as well.
* gettext-tools/examples/README: Mention hello-c-http.
* NEWS: Likewise.
Bruno Haible [Thu, 13 Feb 2025 05:08:04 +0000 (06:08 +0100)]
intl: Update info about Galician and Tamil.
* gettext-runtime/intl/setlocale.c (locales_with_principal_territory): Galician
is mostly spoken in Spain, not Portugal. Tamil is mostly spoken in India, not
Sri Lanka.
Bruno Haible [Wed, 12 Feb 2025 09:39:35 +0000 (10:39 +0100)]
msginit: Update info about Galician and Tamil.
* gettext-tools/src/msginit.c (catalogname_for_locale): Galician is mostly
spoken in Spain, not Portugal. Tamil is mostly spoken in India, not Sri Lanka.
Bruno Haible [Tue, 11 Feb 2025 10:37:40 +0000 (11:37 +0100)]
xgettext: Rust: Support named format string arguments.
Reported by Kévin Commaille <zecakeh@tedomum.fr>
in <https://savannah.gnu.org/bugs/?56774>.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add unictype/property-xid-start,
unictype/property-xid-continue.
(GNULIB_MODULES_LIBGETTEXTPO): Likewise.
* gettext-tools/src/format-rust.c (struct named_arg): New type.
(struct spec): Add fields named_arg_count, named.
(named_arg_compare): New function.
(format_parse): Recognize named arguments.
(format_check): Search for differences also between the named arguments.
(format_print): Print also the named arguments.
* gettext-tools/tests/format-rust-1: Add test cases for named arguments.
* gettext-tools/tests/format-rust-2: Likewise.
* gettext-tools/doc/gettext.texi (rust-format): Describe rust-format in detail.
Bruno Haible [Tue, 11 Feb 2025 08:49:08 +0000 (09:49 +0100)]
Refactor.
* gettext-tools/src/format-ruby.c (format_parse): Use two different variables
named_allocated, numbered_allocated, instead of a single variable (assuming that
INVALID_MIXES_NAMED_UNNAMED is called when it should).
Bruno Haible [Sat, 8 Feb 2025 07:49:16 +0000 (08:49 +0100)]
xgettext: Handle out-of-memory situation.
* gettext-tools/src/x-perl.c: Include xstring-desc.h.
(extract_quotelike): Call xsd_c instead of sd_c.
* gettext-tools/src/x-rust.c: Include xstring-desc.h.
(string_literal_value): Call xsd_c instead of sd_c. Call sb_xappend_desc
instead of sb_append_desc.
Bruno Haible [Tue, 4 Feb 2025 00:03:53 +0000 (01:03 +0100)]
libtextstyle: Improve namespacing.
* gettext-tools/libgettextpo/Makefile.am (COMPILATION_UNITS): Fix reference to
LIBOBJS variable.
(config.h): Remove leading part of the elements of
$(lts_libtextstyle_LTLIBOBJS).
Bruno Haible [Sun, 2 Feb 2025 10:39:54 +0000 (11:39 +0100)]
Sort programming languages like in the documentation.
* gettext-tools/src/xgettext.c (usage): For the -L, -a, -k, --flag options, sort
the list of programming languages like in the documentation. Add Guile, Rust,
GSettings, that were forgotten earlier.
* gettext-tools/doc/xgettext.texi: Likewise.
* gettext-tools/examples/README: Sort the examples like the programming
languages in the documentation.
* gettext-tools/examples/Makefile.am (EXAMPLESFILES, EXAMPLESDIRS): Likewise.
* gettext-tools/examples/check-examples (func_check_autoclean_all,
func_check_distclean_all, func_check_maintainerclean_all,
func_check_maintainerclean_vpath_all, func_check_dist_all,
func_check_dist_vpath_all, func_check_install_all, func_check_uninstall_all,
func_check_distcheck_all, func_check_all): Likewise.
* gettext-tools/examples/po/Makefile.am (POTFILES, SMALLPOTS, hello-*.pot,
SMALLPOFILES_FOR_lang, $(srcdir)/../hello-*/po/$(LL).po): Likewise.
Bruno Haible [Wed, 29 Jan 2025 11:30:02 +0000 (12:30 +0100)]
intl: Fix undefined behaviour.
Found using clang's undefined-behaviour sanitizer:
CC="clang -fsanitize=undefined -fno-sanitize-recover=undefined".
It reported errors
dcigettext.c:1219:25: runtime error: applying non-zero offset 8 to null pointer
because the code was computing
outbuf = freemem + sizeof (size_t);
where freemem == NULL.
* gettext-runtime/intl/dcigettext.c (_nl_find_msg): Initialize outbuf only after
having verified that freemem_size >= sizeof (size_t).
Bruno Haible [Tue, 28 Jan 2025 10:45:28 +0000 (11:45 +0100)]
Rust: Add lang-rust unit test.
* gettext-tools/tests/init.cfg (this_test_is_longrunning_): New function.
* gettext-tools/tests/lang-rust: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.
* HACKING: Reorder. Document prerequisites for Rust unit test.
Kévin Commaille [Tue, 28 Jan 2025 10:08:52 +0000 (11:08 +0100)]
Prepare for Rust support.
* gettext-tools/tests/xgettext-rust-1: New file, based on
gettext-tools/tests/xgettext-csharp-1.
* gettext-tools/tests/xgettext-rust-2: New file, based on
gettext-tools/tests/xgettext-csharp-2.
* gettext-tools/tests/xgettext-rust-3: New file, based on
gettext-tools/tests/xgettext-csharp-3.
* gettext-tools/tests/xgettext-rust-4: New file, based on
gettext-tools/tests/xgettext-csharp-4.
* gettext-tools/tests/xgettext-rust-5: New file, based on
gettext-tools/tests/xgettext-csharp-7.
Reported by <fiurgeist@gmail.com> at <https://savannah.gnu.org/bugs/?66643>.
* gettext-tools/src/x-javascript.c (phase5_get): Treat a '<' character in
level type level_embedded_js_in_xml like in the other level types.
* gettext-tools/tests/xgettext-javascript-6: Add another test case.
* NEWS: Mention the fix.
Bruno Haible [Tue, 31 Dec 2024 01:43:41 +0000 (02:43 +0100)]
When reading PO files, treat CRLF line terminators like LF.
Reported by Hendy Irawan <hendy@hendyirawan.com> at
<https://savannah.gnu.org/bugs/?52395>.
* gettext-tools/src/read-po-internal.h (MBFILE_MAX_PUSHBACK): Renamed from
NPUSHBACK. Increase by 1.
(struct mbfile): Rename field 'have_pushback' to 'pushback_count'.
* gettext-tools/src/read-po-lex.c (mbfile_init): Update.
(mbfile_getc): Read pushed-back character before testing for sticky EOF.
(mbfile_ungetc): Update.
(mbfile_getc_normalized): New function.
(lex_getc): Invoke mbfile_getc_normalized instead of mbfile_getc.
* gettext-tools/tests/testdata/crlf.pot: New file.
* gettext-tools/tests/msgcat-23: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.