]> git.ipfire.org Git - thirdparty/gettext.git/log
thirdparty/gettext.git
8 months agoUpdate legally relevant info. master
Bruno Haible [Mon, 28 Oct 2024 19:13:38 +0000 (20:13 +0100)] 
Update legally relevant info.

* AUTHORS: Incorporate records from gnu.org:/gd/gnuorg/copyright.list.

8 months agodoc: Improve usability of generated PDF.
Bruno Haible [Mon, 28 Oct 2024 11:53:05 +0000 (12:53 +0100)] 
doc: Improve usability of generated PDF.

* gettext-tools/doc/gettext.texi: Use a brown colour for interactive links.

8 months agobuild: Fix "make distcheck" failure (regression 2024-10-23).
Bruno Haible [Fri, 25 Oct 2024 07:56:29 +0000 (09:56 +0200)] 
build: Fix "make distcheck" failure (regression 2024-10-23).

* check-copyright-headers (func_check_file): Update after DISCLAIM was renamed.

8 months agodoc: Add some words about dialects.
Bruno Haible [Thu, 24 Oct 2024 11:40:20 +0000 (13:40 +0200)] 
doc: Add some words about dialects.

Reported by John Cowan <cowan@ccil.org>
at <https://savannah.gnu.org/bugs/?47838>.

* gettext-tools/doc/gettext.texi (The LANGUAGE variable): Add a paragraph
about Chinese.
(Dialects): New section.

8 months agodoc: Tweaks.
Bruno Haible [Wed, 23 Oct 2024 19:27:58 +0000 (21:27 +0200)] 
doc: Tweaks.

* gettext-tools/doc/gettext.texi (Responsibilities): Tweaks, from
Benno Schulenberg.

8 months agodoc: Revise "Translators" chapter.
Bruno Haible [Wed, 23 Oct 2024 11:06:34 +0000 (13:06 +0200)] 
doc: Revise "Translators" chapter.

* gettext-tools/doc/gettext.texi (Trans Intro 0, Trans Intro 1, Discussions,
Organization, Information Flow): Remove sections.
(Organization, Responsibilities): New sections.

8 months agoRename and distribute the disclaimer file.
Bruno Haible [Wed, 23 Oct 2024 11:27:58 +0000 (13:27 +0200)] 
Rename and distribute the disclaimer file.

* gettext-tools/misc/disclaim-translations.txt: Renamed from
gettext-tools/misc/DISCLAIM.
* gettext-tools/Makefile.am (EXTRA_DIST): Update.
(pkgdata_DATA): New variable.

8 months agobuild: Simplify.
Bruno Haible [Wed, 23 Oct 2024 11:27:07 +0000 (13:27 +0200)] 
build: Simplify.

* gettext-tools/Makefile.am (gettextsrcdir): Remove variable.
(pkgdata_SCRIPTS): Renamed from gettextsrc_SCRIPTS.

8 months agoFix test failure of autopoint-3 on Cygwin.
Bruno Haible [Wed, 23 Oct 2024 07:59:49 +0000 (09:59 +0200)] 
Fix test failure of autopoint-3 on Cygwin.

It was broken since commit "tests: Use libtool in autopoint-3 test" (2014-09-05):
The Makefile specified to link the 'hello' program without libtool
(and thus Automake generated a direct link command without libtool),
but the LDADD variable used @LTLIBINTL@. On Cygwin, this led to a use of
the -R option, which the compiler does not understand:
x86_64-pc-cygwin-gcc: error: unrecognized command line option ‘-R’; did you mean ‘-R’?

* gettext-tools/tests/autopoint-3: Don't invoke LT_INIT. Use @LIBINTL@,
not @LTLIBINTL@. Don't touch ltmain.sh.

8 months agoImprove handling of Windows DLL directories when executing programs.
Bruno Haible [Wed, 23 Oct 2024 07:39:50 +0000 (09:39 +0200)] 
Improve handling of Windows DLL directories when executing programs.

Reported by Michele Locati <mlocati@gmail.com>
at <https://savannah.gnu.org/bugs/?66356>.

Revert commit e2839b591c from 2019-05-01. Instead, use gnulib's new feature.

* gettext-tools/src/Makefile.am (DEFS): Define BINDIR.
* gettext-tools/src/msginit.c: Don't include configmake.h.
(main): Don't add BINDIR to PATH globally.
(get_user_email, language_team_address, plural_forms): Pass a dll_dirs argument
to create_pipe_in.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Remove configmake.

8 months agoUpdate after gnulib changed.
Bruno Haible [Tue, 22 Oct 2024 20:24:44 +0000 (22:24 +0200)] 
Update after gnulib changed.

* gettext-tools/src/msgexec.c (process_string): Update create_pipe_out
invocation.
* gettext-tools/src/write-resources.c (execute_writing_input): Likewise.
* gettext-tools/src/msginit.c (project_id, project_id_version, get_user_email,
language_team_address, plural_forms): Update create_pipe_in invocations.
* gettext-tools/src/read-csharp.c (execute_and_read_po_output): Likewise.
* gettext-tools/src/read-java.c (execute_and_read_po_output): Likewise.
* gettext-tools/src/read-resources.c (execute_and_read_po_output): Likewise.
* gettext-tools/src/read-tcl.c (msgdomain_read_tcl): Likewise.
* gettext-tools/src/x-ruby.c (extract_ruby): Likewise.
* gettext-tools/src/urlget.c (execute_it, fetch): Update execute invocations.

8 months agoUpdate to the newest gnulib.
Bruno Haible [Tue, 22 Oct 2024 20:16:51 +0000 (22:16 +0200)] 
Update to the newest gnulib.

8 months agoUpdate the translation disclaimer.
Bruno Haible [Tue, 22 Oct 2024 10:33:35 +0000 (12:33 +0200)] 
Update the translation disclaimer.

From Craig Topham <copyright-clerk@fsf.org>.

* gettext-tools/misc/DISCLAIM: Update.

8 months agodoc: Update after Automake changed.
Bruno Haible [Sun, 20 Oct 2024 22:46:53 +0000 (00:46 +0200)] 
doc: Update after Automake changed.

* gettext-tools/doc/gettextize.texi: Update now that Automake with option 'gnu'
no longer requires ABOUT-NLS. Cf.
<https://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=a2def8cdef>.

8 months agodoc: Add an example regarding xgettext.
Bruno Haible [Fri, 18 Oct 2024 17:19:38 +0000 (19:19 +0200)] 
doc: Add an example regarding xgettext.

Reported by Andrea G. Monaco <andrea.monaco@autistici.org> in
<https://lists.gnu.org/archive/html/bug-gettext/2020-12/msg00036.html>.

* gettext-tools/doc/xgettext.texi: Add an example.

8 months agoxgettext: Python: Add test for warning that was broken in 0.21.x and 0.22.x.
Bruno Haible [Thu, 17 Oct 2024 23:16:12 +0000 (01:16 +0200)] 
xgettext: Python: Add test for warning that was broken in 0.21.x and 0.22.x.

Reported by Max Smolens <msmolens@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gettext/2020-10/msg00001.html>.

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

8 months agodoc: Clarify locale names and language names.
Bruno Haible [Thu, 17 Oct 2024 21:53:17 +0000 (23:53 +0200)] 
doc: Clarify locale names and language names.

Reported by Arfrever <arfrever.fta@gmail.com>
at <https://savannah.gnu.org/bugs/?59062>.

* gettext-runtime/doc/nls.texi (INSTALL Matters, Using This Package): Mention
ll_CC as alterntive to ll, and that ll can be a 3-letter code.
* gettext-tools/doc/gettext.texi (Locale Names, Header Entry, Installers):
Likewise.

8 months agointl: Fix a memory leak.
Bruno Haible [Tue, 15 Oct 2024 19:52:30 +0000 (21:52 +0200)] 
intl: Fix a memory leak.

* gettext-runtime/intl/finddomain.c (_nl_find_domain): If there was an alias and
_nl_explode_name or _nl_make_l10nflist fails, free the allocated memory. Avoid
'goto'.

8 months agogettext.h: Avoid "warning: ISO C++ forbids variable length array" with -pedantic.
Bruno Haible [Tue, 15 Oct 2024 14:49:13 +0000 (16:49 +0200)] 
gettext.h: Avoid "warning: ISO C++ forbids variable length array" with -pedantic.

Both "g++ -pedantic" and "clang++ -pedantic" warn about use of VLAs.
Since we cannot distinguish "g++" from "g++ -pedantic" through a preprocessor
macro, it's best to not use a VLA in C++.

Reported by Jens Seidel <jensseidel@users.sf.net>
via <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=547798>
at <https://savannah.gnu.org/bugs/index.php?55149>.

* gnulib-local/lib/gettext.h (_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS): Define
to 0 in C++ mode.

8 months agomsgen: Convert charset=CHARSET to charset=ASCII.
Bruno Haible [Tue, 15 Oct 2024 14:04:45 +0000 (16:04 +0200)] 
msgen: Convert charset=CHARSET to charset=ASCII.

Reported at <https://savannah.gnu.org/bugs/index.php?20923>.

* gettext-tools/src/msgen.c: Include msgl-ascii.h, c-strstr.h, xalloc.h.
(fill_header): New function, based on fill_header in msginit.c.
(main): Invoke it.
* gettext-tools/tests/msgen-1: Provide as input a POT file with charset=CHARSET,
and verify that the output has charset=ASCII.

8 months agoRefactor.
Bruno Haible [Tue, 15 Oct 2024 13:42:46 +0000 (15:42 +0200)] 
Refactor.

* gettext-tools/src/msgl-header.h (header_set_charset): New declaration.
* gettext-tools/src/msgl-header.c (header_set_charset): New function.
* gettext-tools/src/msgl-iconv.c: Include msgl-header.h.
(iconv_message_list_internal): Use header_set_charset.
* gettext-tools/src/x-po.c: Include msgl-header.h.
(extract): Use header_set_charset.
* gettext-tools/src/FILES: Update.

8 months agoits: Add ability to check *.its and *.loc files with XML Schema 1.1.
Bruno Haible [Tue, 15 Oct 2024 00:37:28 +0000 (02:37 +0200)] 
its: Add ability to check *.its and *.loc files with XML Schema 1.1.

* gettext-tools/src/its.xsd10: Renamed from gettext-tools/src/its.xsd.
(RulesType): Enumerate all possible rules in the ITS namespace, instead of using
a wildcard.
(OtherRuleType): New element.
* gettext-tools/src/its.xsd11: Copied from gettext-tools/src/its.xsd.
(LocNoteRuleType): Enable assertion.
* gettext-tools/src/locating-rules.xsd10: Renamed from
gettext-tools/src/locating-rules.xsd.
* gettext-tools/src/locating-rules.xsd11: Copied from
gettext-tools/src/locating-rules.xsd.
(LocatingRuleType): Enable assertion.
* gettext-tools/src/Makefile.am (schema_DATA): Add its.xsd10, its.xsd11,
locating-rules.xsd10, locating-rules.xsd11. Remove its.xsd, locating-rules.xsd.
* gettext-tools/build-aux/xml-validate-10.in: New file.
* gettext-tools/build-aux/xml-validate-11.in: New file.
* gettext-tools/configure.ac: Substitute HAVE_JAVAEXEC.
(AC_CONFIG_FILES): Create build-aux/xml-validate-10, build-aux/xml-validate-11.
* gettext-tools/Makefile.am (DISTCLEANFILES): Add build-aux/xml-validate-10,
build-aux/xml-validate-11.
* gettext-tools/its/Makefile.am: Revert last commit.
(check-local): Check each file both using the XML Schema 1.0 and the XML Schema
1.1.
* gettext-tools/doc/gettext.texi (ITS Rules): Mention the two versions of
its.xsd.
(Location Rules): Mention the two versions of locating-rules.xsd.
* HACKING: Mention Xerces2-J.

8 months agoits: Work around xmllint bug.
Bruno Haible [Mon, 14 Oct 2024 15:24:52 +0000 (17:24 +0200)] 
its: Work around xmllint bug.

* gettext-tools/its/Makefile.am (check-local): Skip the ITS_FILES checks if
xmllint cannot grok the its.xsd schema.

8 months agopo: Add a copyright and license notice to the Rules-quot auxiliary files.
Bruno Haible [Sun, 13 Oct 2024 23:41:49 +0000 (01:41 +0200)] 
po: Add a copyright and license notice to the Rules-quot auxiliary files.

Reported by Joël Krähemann <jkraehemann@gmail.com>
at <https://savannah.gnu.org/bugs/?57973>.

* gettext-runtime/po/quot.sed: Add a copyright and all-permissive license
notice.
* gettext-runtime/po/boldquot.sed: Likewise.
* gettext-runtime/po/en@quot.header: Likewise.
* gettext-runtime/po/en@boldquot.header: Likewise.
* gettext-runtime/po/insert-header.sed: Use an all-permissive license notice.
* gettext-runtime/po/Rules-quot: Likewise.
(.insert-header.po-update-en): After running the *.insert-header script,
eliminate lines that start with %%.

8 months agopo: Assume a 'sed' that supports '#' for introducing comments.
Bruno Haible [Sun, 13 Oct 2024 20:37:39 +0000 (22:37 +0200)] 
po: Assume a 'sed' that supports '#' for introducing comments.

This is standardized in POSIX since POSIX:2001 (= SUSv3).
It is supported on all platforms that I could test:
GNU, macOS 10.5, FreeBSD 5, NetBSD 7, OpenBSD 6, AIX 7, Solaris 10 and 11,
busybox (2019).

* gettext-runtime/po/remove-potcdate.sed: Renamed from
gettext-runtime/po/remove-potcdate.sin.
* gettext-runtime/po/Makefile.in.in (DISTFILES.common): Update.
(.SUFFIXES): Remove .sin.
(.sin.sed): Remove rule.
($(DOMAIN).pot-update): Use remove-potcdate.sed in $(srcdir).
(mostlyclean): Don't remove remove-potcdate.sed.
* autogen.sh: Update.
* Makefile.am (distcheck-hook): Update.
* gettext-tools/examples/po/remove-potcdate.sed: Renamed from
gettext-tools/examples/po/remove-potcdate.sin.
* gettext-tools/examples/po/Makefile.am ($(DOMAIN).pot-update): Use
remove-potcdate.sed in $(srcdir).
(MOSTLYCLEANFILES): Don't add remove-potcdate.sed.
(EXTRA_DIST): Update.
* gettext-tools/examples/hello-*/po/Makefile.am ($(DOMAIN).pot-update): Use
remove-potcdate.sed in $(srcdir).
(MOSTLYCLEANFILES): Don't add remove-potcdate.sed.
(EXTRA_DIST): Update.
* gettext-tools/examples/hello-objc-gnustep/po/GNUmakefile
($(DOMAIN).pot-update): Remove dependency on remove-potcdate.sed.
(internal-clean): Remove rule.
* gettext-tools/examples/hello-*/autogen.sh: Update.
* gettext-tools/examples/hello-*/autoclean.sh: Update.

8 months agopo: Assume a 'sed' that supports '#' for introducing comments.
Bruno Haible [Sun, 13 Oct 2024 20:36:41 +0000 (22:36 +0200)] 
po: Assume a 'sed' that supports '#' for introducing comments.

This is standardized in POSIX since POSIX:2001 (= SUSv3).
It is supported on all platforms that I could test:
GNU, macOS 10.5, FreeBSD 5, NetBSD 7, OpenBSD 6, AIX 7, Solaris 10 and 11,
busybox (2019).

* gettext-runtime/po/insert-header.sed: Renamed from
gettext-runtime/po/insert-header.sin.
* gettext-runtime/po/Rules-quot (DISTFILES.common.extra1): Update.
(en@quot.insert-header, en@boldquot.insert-header): Use insert-header.sed
instead of insert-header.sin.
* autogen.sh: Update.
* Makefile.am (distcheck-hook): Update.
* gettext-tools/examples/hello-*/autogen.sh: Update.
* gettext-tools/doc/gettext.texi (po/LINGUAS): Update.

8 months agoits: Extend schema so that docbook4.its and docbook5.its pass.
Bruno Haible [Sun, 13 Oct 2024 22:28:38 +0000 (00:28 +0200)] 
its: Extend schema so that docbook4.its and docbook5.its pass.

* gettext-tools/src/its.xsd: Add an <any> element that catches other rules.

8 months agotests: Add more unit tests regarding Desktop files.
Bruno Haible [Sun, 13 Oct 2024 18:58:37 +0000 (20:58 +0200)] 
tests: Add more unit tests regarding Desktop files.

Reported by Felix Riemann at <https://savannah.gnu.org/bugs/?51177>
and by Daniel <daniel.rf710@gmail.com>
at <https://savannah.gnu.org/bugs/?63455>.

* gettext-tools/tests/xgettext-desktop-3: New file.
* gettext-tools/tests/msgfmt-desktop-4: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add them.

8 months agoxgettext: Desktop: Correct the line numbers in the output and in error messages.
Bruno Haible [Sun, 13 Oct 2024 18:18:15 +0000 (20:18 +0200)] 
xgettext: Desktop: Correct the line numbers in the output and in error messages.

* gettext-tools/src/read-desktop.c (struct token_ty): Add a 'lineno' field.
(desktop_lex): Correct the line numbers in error messages. For a token of type
token_type_pair, store the line number.
(desktop_parse): Pass the line number from the token to
desktop_reader_handle_pair.
* gettext-tools/tests/xgettext-desktop-1: Update expected output.
* gettext-tools/tests/xgettext-desktop-2: Likewise.
* NEWS: Mention the change.

8 months agotests: Make it easier to single-step the msgfmt-* tests.
Bruno Haible [Sun, 13 Oct 2024 18:49:01 +0000 (20:49 +0200)] 
tests: Make it easier to single-step the msgfmt-* tests.

* gettext-tools/tests/msgfmt-desktop-1: Assign a default to MSGFMT.
* gettext-tools/tests/msgfmt-desktop-2: Likewise.
* gettext-tools/tests/msgfmt-desktop-3: Likewise.
* gettext-tools/tests/msgfmt-xml-1: Likewise.
* gettext-tools/tests/msgfmt-xml-2: Likewise.
* gettext-tools/tests/msgfmt-xml-3: Likewise.
* gettext-tools/tests/msgfmt-xml-4: Likewise.
* gettext-tools/tests/msgfmt-xml-5: Likewise.

8 months agomsgmerge, msginit: Reject POT files with non-ASCII character, except in UTF-8, part 2.
Bruno Haible [Sun, 13 Oct 2024 16:57:51 +0000 (18:57 +0200)] 
msgmerge, msginit: Reject POT files with non-ASCII character, except in UTF-8, part 2.

* gettext-tools/src/msgl-charset.c (check_pot_charset): Tweak the new code.

8 months agomsgmerge, msginit: Reject POT files with non-ASCII characters, except in UTF-8.
Bruno Haible [Sun, 13 Oct 2024 16:47:47 +0000 (18:47 +0200)] 
msgmerge, msginit: Reject POT files with non-ASCII characters, except in UTF-8.

Reported by Martin Quinson <mquinson@debian.org>
at <https://savannah.gnu.org/bugs/?65104>.

* gettext-tools/src/msgl-charset.h (check_pot_charset): New declaration.
* gettext-tools/src/msgl-charset.c: Include msgl-ascii.h.
(check_pot_charset): New function.
* gettext-tools/src/msginit.c: Include msgl-charset.h.
(main): Invoke check_pot_charset.
* gettext-tools/src/msgmerge.c: Include msgl-charset.h.
(merge): Invoke check_pot_charset.
* gettext-tools/src/FILES: Update.
* gettext-tools/tests/testdata/nonascii.pot: New file.
* gettext-tools/tests/msginit-5: New file.
* gettext-tools/tests/msgmerge-charset-4: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add them.
(EXTRA_DIST): Add testdata/nonascii.pot.

8 months agotests: Reorganize msgmerge tests.
Bruno Haible [Sun, 13 Oct 2024 16:28:39 +0000 (18:28 +0200)] 
tests: Reorganize msgmerge tests.

* gettext-tools/tests/msgmerge-9: Renamed from gettext-tools/tests/msgmerge-18.
* gettext-tools/tests/msgmerge-10: Renamed from gettext-tools/tests/msgmerge-19.
* gettext-tools/tests/msgmerge-11: Renamed from gettext-tools/tests/msgmerge-20.
* gettext-tools/tests/msgmerge-12: Renamed from gettext-tools/tests/msgmerge-25.
* gettext-tools/tests/msgmerge-13: Renamed from gettext-tools/tests/msgmerge-26.
* gettext-tools/tests/msgmerge-14: Renamed from gettext-tools/tests/msgmerge-27.
* gettext-tools/tests/msgmerge-15: Renamed from gettext-tools/tests/msgmerge-29.
* gettext-tools/tests/Makefile.am (TESTS): Update.

8 months agotests: Reorganize msgmerge tests.
Bruno Haible [Sun, 13 Oct 2024 16:20:51 +0000 (18:20 +0200)] 
tests: Reorganize msgmerge tests.

* gettext-tools/tests/msgmerge-6: Renamed from gettext-tools/tests/msgmerge-9.
* gettext-tools/tests/msgmerge-7: Renamed from gettext-tools/tests/msgmerge-15.
* gettext-tools/tests/msgmerge-8: Renamed from gettext-tools/tests/msgmerge-17.
* gettext-tools/tests/Makefile.am (TESTS): Update.

8 months agotests: Reorganize msgmerge tests.
Bruno Haible [Sun, 13 Oct 2024 16:10:52 +0000 (18:10 +0200)] 
tests: Reorganize msgmerge tests.

* gettext-tools/tests/msgmerge-domain-1: Renamed from gettext-tools/tests/msgmerge-7.
* gettext-tools/tests/msgmerge-domain-2: Renamed from gettext-tools/tests/msgmerge-8.
* gettext-tools/tests/msgmerge-charset-1: Renamed from gettext-tools/tests/msgmerge-6.
* gettext-tools/tests/msgmerge-charset-2: Renamed from gettext-tools/tests/msgmerge-14.
* gettext-tools/tests/msgmerge-charset-3: Renamed from gettext-tools/tests/msgmerge-16.
* gettext-tools/tests/msgmerge-format-1: Renamed from gettext-tools/tests/msgmerge-13.
* gettext-tools/tests/msgmerge-format-2: Renamed from gettext-tools/tests/msgmerge-21.
* gettext-tools/tests/msgmerge-format-3: Renamed from gettext-tools/tests/msgmerge-28.
* gettext-tools/tests/msgmerge-plural-1: Renamed from gettext-tools/tests/msgmerge-10.
* gettext-tools/tests/msgmerge-plural-2: Renamed from gettext-tools/tests/msgmerge-11.
* gettext-tools/tests/msgmerge-plural-3: Renamed from gettext-tools/tests/msgmerge-12.
* gettext-tools/tests/msgmerge-plural-4: Renamed from gettext-tools/tests/msgmerge-22.
* gettext-tools/tests/msgmerge-plural-5: Renamed from gettext-tools/tests/msgmerge-23.
* gettext-tools/tests/msgmerge-plural-6: Renamed from gettext-tools/tests/msgmerge-24.
* gettext-tools/tests/Makefile.am (TESTS): Update.

8 months agoits: Support DocBook XML, part 2.
Bruno Haible [Sun, 13 Oct 2024 10:49:40 +0000 (12:49 +0200)] 
its: Support DocBook XML, part 2.

Reported by Guillem Jover <guillem@hadrons.org>
at <https://savannah.gnu.org/bugs/?52415>.

* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add xstring-desc.
* gettext-tools/src/its.c: Include xstring-desc.h, c-ctype.h, unistr.h.
(SIZEOF): New macro.
(its_extension_escape_rule_constructor, its_extension_escape_rule_eval): Handle
the 'unescape-if' attribute.
(starts_with_character_reference): Add an ucs_p parameter.
(_its_encode_special_chars_for_merge): Update.
(set_doc_encoding_utf8, _its_is_valid_simple_gen_xml, _its_is_valid_simple_xml,
is_valid_xhtml_element, _its_is_valid_simple_xhtml, is_valid_html_element,
is_no_end_html_element, _its_is_valid_simple_html, _its_set_simple_xml_content,
_its_set_simple_html_content): New functions.
(its_merge_context_merge_node): Implement the 'unescape-if' attribute.
* gettext-tools/src/its-extensions.xsd (EscapeRuleType): Add 'unescape-if'
attribute.
* gettext-tools/its/docbook4.its: Add an <escapeRule>.
* gettext-tools/its/docbook5.its: Likewise.
* gettext-tools/tests/xgettext-docbook-1: New file.
* gettext-tools/tests/msgfmt-xml-5: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add them.
* gettext-tools/doc/gettext.texi (ITS Rules): Document the 'unescape-if'
attribute of the escapeRule.
* NEWS: Mention the change.

8 months agoits: Support DocBook XML, part 1.
Bruno Haible [Sun, 13 Oct 2024 10:34:35 +0000 (12:34 +0200)] 
its: Support DocBook XML, part 1.

Reported by Guillem Jover <guillem@hadrons.org>
at <https://savannah.gnu.org/bugs/?52415>.

* gettext-tools/its/docbook4.its: New file, copied from
https://github.com/itstool/itstool file its/docbook.its.
* gettext-tools/its/docbook5.its: New file, copied from
https://github.com/itstool/itstool file its/docbook5.its.
* gettext-tools/its/docbook.loc: New file.
* gettext-tools/its/Makefile.am (ITS_FILES): Add docbook4.its, docbook5.its.
(LOC_FILES): Add docbook.loc.

8 months agoUpdate to the newest gnulib.
Bruno Haible [Sun, 13 Oct 2024 10:33:04 +0000 (12:33 +0200)] 
Update to the newest gnulib.

8 months agoits: Improve error handling.
Bruno Haible [Sun, 13 Oct 2024 01:00:35 +0000 (03:00 +0200)] 
its: Improve error handling.

* gettext-tools/src/its.c: Include libxml/xmlerror.h.
(structured_error): New function.
(its_rule_list_add_from_file, its_rule_list_add_from_string,
its_rule_list_extract, its_merge_context_alloc): Exit upon fatal error.
Set the structured_error for the rest of the function.
(its_merge_context_merge, its_merge_context_write): Set the structured_error.

8 months agoits: Simplify escape handling change from 2024-10-01.
Bruno Haible [Sat, 12 Oct 2024 14:43:51 +0000 (16:43 +0200)] 
its: Simplify escape handling change from 2024-10-01.

* gettext-tools/src/its.c: Add comments about evaluation rules.
(its_extension_escape_rule_eval): Handle local attribute "escape" here...
(its_rule_list_extract_text, its_merge_context_merge_node): ... not here.

8 months agoits: Fix NULL dereference (regression 2024-10-01).
Bruno Haible [Fri, 11 Oct 2024 20:30:09 +0000 (22:30 +0200)] 
its: Fix NULL dereference (regression 2024-10-01).

* gettext-tools/src/its.c (_its_copy_node_with_attributes): Handle attributes
without namespace correctly.

8 months agobuild: Add support for --enable-relocatable in mingw builds on Cygwin hosts, part 2.
Bruno Haible [Fri, 11 Oct 2024 17:53:35 +0000 (19:53 +0200)] 
build: Add support for --enable-relocatable in mingw builds on Cygwin hosts, part 2.

Reported by Michele Locati <michele@locati.it> in
<https://savannah.gnu.org/bugs/?66319>.

* gettext-tools/configure.ac: Invoke gl_CONFIGMAKE_PREP and fix up the values of
pkgdatadir, pkgincludedir, pkglibdir, pkglibexecdir.
Invoke gl_BUILD_TO_HOST_LIBDIR, gl_BUILD_TO_HOST_LIBEXECDIR,
gl_BUILD_TO_HOST_PKGDATADIR, gl_BUILD_TO_HOST_PKGLIBDIR.
* gettext-tools/src/Makefile.am (pkgdatadir, pkglibdir, pkglibexecdir): Remove
variables.
(jardir): Simplify.
(jardir_c_make, projectsdir_c_make): New variables.
(*_CPPFLAGS): Fix value of BISON_LOCALEDIR, GETTEXTJAR, LIBDIR, LIBEXECDIR,
GETTEXTDATADIR, PROJECTSDIR.

8 months agoUpdate to the newest gnulib.
Bruno Haible [Fri, 11 Oct 2024 15:44:37 +0000 (17:44 +0200)] 
Update to the newest gnulib.

8 months agoits: Allow a specific XML namespace for .metainfo.xml / .appdata.xml files.
Bruno Haible [Fri, 11 Oct 2024 10:55:42 +0000 (12:55 +0200)] 
its: Allow a specific XML namespace for .metainfo.xml / .appdata.xml files.

Reported by Claude Paroz <claude@2xlibre.net>
at <https://savannah.gnu.org/bugs/?54472>.

* gettext-tools/its/metainfo.its: Duplicate the rules for XML instances that
use the metainfo namespace.
* gettext-tools/tests/xgettext-appdata-3: New file, based on
gettext-tools/tests/xgettext-appdata-2.
* gettext-tools/tests/Makefile.am (TESTS): Add it.

8 months agobuild: Remove left-over files from the C# compiler of 'dotnet'.
Bruno Haible [Thu, 10 Oct 2024 19:42:53 +0000 (21:42 +0200)] 
build: Remove left-over files from the C# compiler of 'dotnet'.

* gettext-tools/src/Makefile.am (CLEANFILES): Add msgfmt.net.pdb,
msgunfmt.net.pdb.

8 months agobuild: Avoid "warning: stray \ before -" from GNU grep ≥ 3.8.
Bruno Haible [Wed, 9 Oct 2024 21:40:29 +0000 (23:40 +0200)] 
build: Avoid "warning: stray \ before -" from GNU grep ≥ 3.8.

* build-aux/jar-cf: Remove an unnecessary backslash.

8 months agobuild: Revert the revert, and use Sergey Poznyakoff's fix instead.
Bruno Haible [Wed, 9 Oct 2024 21:11:41 +0000 (23:11 +0200)] 
build: Revert the revert, and use Sergey Poznyakoff's fix instead.

Sergey's fix is at
<https://debbugs.gnu.org/cgi/bugreport.cgi?msg=17;bug=73620> =
<https://lists.gnu.org/archive/html/bug-libtool/2024-10/msg00008.html>.

8 months agobuild: Revert build failure on CentOS and Alma Linux (regression 2024-09-26).
Bruno Haible [Wed, 9 Oct 2024 13:57:00 +0000 (15:57 +0200)] 
build: Revert build failure on CentOS and Alma Linux (regression 2024-09-26).

build-aux/ltmain.sh: Revert libtool commit
0e1b33332429cd578367bd0ad420c065d5caf0ac.

8 months agoC#: Add support for dotnet.
Bruno Haible [Wed, 9 Oct 2024 02:06:47 +0000 (04:06 +0200)] 
C#: Add support for dotnet.

Reported by Michele Locati <mlocati@gmail.com>
at <https://savannah.gnu.org/bugs/index.php?66292>.

* DEPENDENCIES: Mention dotnet as an alternative to Mono.
* NEWS: Mention the change.
* PACKAGING: Mention the new file $prefix/lib/gettext/GNU.Gettext.dll.
* gettext-runtime/intl-csharp/Makefile.am (pkglibdir): New variable.
(CLEANFILES): Add GNU.Gettext.pdb.
(install-dll-no, install-dll-yes): Install also into $(pkglibdir).
(installdirs-dll, uninstall-dll): Update accordingly.
* gettext-runtime/intl-csharp/intl.cs (GettextResourceSet): Add field Table.
Override GetEnumerator, GetObject to handle it. Change the Keys method to handle
it as well.
* gettext-tools/tests/lang-csharp: In the program, on Windows, produce UTF-8
output with Unix end-of-lines and set the culture manually.

8 months agoUpdate to the newest gnulib.
Bruno Haible [Wed, 9 Oct 2024 02:00:35 +0000 (04:00 +0200)] 
Update to the newest gnulib.

8 months agoImprove C# support on Cygwin.
Bruno Haible [Mon, 7 Oct 2024 18:39:07 +0000 (20:39 +0200)] 
Improve C# support on Cygwin.

* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add cygpath.
* gettext-tools/src/read-csharp.c: Include cygpath.h.
(msgdomain_read_csharp): Convert the directory passed to msgunfmt.net.exe from
Cygwin to Windows syntax.
* gettext-tools/src/read-resources.c: Include cygpath.h.
(read_resources_file): Convert the file name passed to msgunfmt.net.exe from
Cygwin to Windows syntax.
* gettext-tools/src/write-resources.c: Include cygpath.h.
(msgdomain_write_csharp_resources): Convert the file name passed to
msgfmt.net.exe from Cygwin to Windows syntax.

8 months agoUpdate to the newest gnulib.
Bruno Haible [Mon, 7 Oct 2024 18:34:23 +0000 (20:34 +0200)] 
Update to the newest gnulib.

9 months agomsgfmt: New option --replace-text.
Bruno Haible [Sun, 6 Oct 2024 07:43:43 +0000 (09:43 +0200)] 
msgfmt: New option --replace-text.

Reported by Asterix <asterix@lagaule.org>
at <https://savannah.gnu.org/bugs/?52159>.

* gettext-tools/src/its.h (its_merge_context_merge): Add parameter replace_text.
* gettext-tools/src/its.c (its_merge_context_merge_node): Add parameter
replace_text.
(its_merge_context_merge): Likewise.
* gettext-tools/src/write-xml.h (msgdomain_write_xml, msgdomain_write_xml_bulk):
Add parameter replace_text.
* gettext-tools/src/write-xml.c (msgdomain_write_xml_bulk): Add parameter
replace_text.
(msgdomain_write_xml): Likewise.
* gettext-tools/src/msgfmt.c (xml_replace_text): New variable.
(long_options): Add --replace-text.
(main): Handle --replace-text.
(usage): Document option --replace-text.
* gettext-tools/tests/msgfmt-xml-4: New file, based on
gettext-tools/tests/msgfmt-xml-1.
* gettext-tools/tests/Makefile.am (TESTS): Add it.
* gettext-tools/doc/msgfmt.texi: Document option --replace-text.
* NEWS: Mention the change.

9 months agoits: Improve comments in *.its files.
Bruno Haible [Sun, 6 Oct 2024 01:27:19 +0000 (03:27 +0200)] 
its: Improve comments in *.its files.

* gettext-tools/its/glade2.its: Improve comments.
* gettext-tools/its/gtkbuilder.its: Likewise.
* gettext-tools/its/gsettings.its: Likewise.
* gettext-tools/its/metainfo.its: Likewise.

9 months agodoc: Update copyright year.
Bruno Haible [Sat, 5 Oct 2024 17:10:52 +0000 (19:10 +0200)] 
doc: Update copyright year.

9 months agodoc: Document how to use custom *.its files.
Bruno Haible [Sat, 5 Oct 2024 15:53:52 +0000 (17:53 +0200)] 
doc: Document how to use custom *.its files.

Reported by Stefan Brüns <stefan.bruens@rwth-aachen.de>
at <https://savannah.gnu.org/bugs/?64026>.

* gettext-tools/src/search-path.c (get_search_path): Improve comments.
* gettext-tools/doc/xgettext.texi: New subsection "Options for XML input files".
Move the description of --its out of subsection "Output details".
* gettext-tools/doc/msgfmt.texi: Document GETTEXTDATADIRS.
* gettext-tools/doc/gettext.texi (Installers): Document the
PREFIX/share/gettext/its/ directory.

9 months agodoc: Mention some related packages.
Bruno Haible [Fri, 4 Oct 2024 23:50:19 +0000 (01:50 +0200)] 
doc: Mention some related packages.

* gettext-tools/doc/gettext.texi (OmegaT, Virtaal, Vim): New sections.
(Other tools): Mention the Translate Toolkit.
* gettext-tools/doc/lang-python.texi: Mention Babel.

9 months agoits: Fix the value of the xml:lang attribute inserted by msgfmt.
Bruno Haible [Thu, 3 Oct 2024 20:34:14 +0000 (22:34 +0200)] 
its: Fix the value of the xml:lang attribute inserted by msgfmt.

Reported by Matthias Klumpp <matthias@tenstral.net>
at <https://savannah.gnu.org/bugs/?64025>.

* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add bcp47.
* gettext-tools/src/its.c: Include "bcp47.h".
(its_merge_context_merge_node): Convert the language / locale name to BCP 47
syntax before storing it in the xml:lang attribute.
* gettext-tools/tests/msgfmt-xml-3: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.
* NEWS: Mention the change.

9 months agoUpdate to the newest gnulib.
Bruno Haible [Thu, 3 Oct 2024 20:20:21 +0000 (22:20 +0200)] 
Update to the newest gnulib.

9 months agoits: Fix permissions of newly added test.
Bruno Haible [Thu, 3 Oct 2024 19:19:32 +0000 (21:19 +0200)] 
its: Fix permissions of newly added test.

9 months agoUpdate the file list.
Bruno Haible [Tue, 1 Oct 2024 20:21:30 +0000 (22:21 +0200)] 
Update the file list.

* gettext-tools/src/FILES: Update.
* gettext-tools/src/write-desktop.h: Fix comment.
* gettext-tools/src/write-xml.h: Likewise.

9 months agoits: During merge, copy also the XML node's attributes.
Bruno Haible [Tue, 1 Oct 2024 19:28:37 +0000 (21:28 +0200)] 
its: During merge, copy also the XML node's attributes.

Rationale: In XHTML, attributes like 'style' are used for rendering.

* gettext-tools/src/its.c (_its_copy_node_with_attributes): New function.
(its_merge_context_merge_node): Use it.
* gettext-tools/tests/msgfmt-xml-1: Update expected results.
* gettext-tools/tests/msgfmt-xml-2: Likewise.

9 months agoits: Do escape handling during msgfmt merge, not during xgettext. Off by default.
Bruno Haible [Tue, 1 Oct 2024 14:42:56 +0000 (16:42 +0200)] 
its: Do escape handling during msgfmt merge, not during xgettext. Off by default.

Reported by Samy Mahmoudi <samy.mahmoudi@gmail.com>
at <https://savannah.gnu.org/bugs/?58643>.

* gettext-tools/src/its.c (its_localization_note_rule_constructor): Don't do
escaping while extracting a localization note.
(its_rule_list_extract_text): New local variable do_escape_during_extract. Don't
do escaping while extracting.
(starts_with_character_reference, _its_encode_special_chars_for_merge): New
functions.
(its_merge_context_merge_node): New local variables do_escape_during_extract,
do_escape_during_merge. Don't do escaping while extracting. Conditionally do
escaping while merging.
* gettext-tools/src/its-extensions.xsd: Mention that escape="no" is now the
default.
* gettext-tools/its/glade1.its: Add a comment.
* gettext-tools/its/glade2.its: Likewise.
* gettext-tools/its/gsettings.its: Likewise.
* gettext-tools/its/gtkbuilder.its: Likewise.
* gettext-tools/its/metainfo.its: Add a <gt:escapeRule>.
* gettext-tools/tests/xgettext-appdata-1: Add comment.
* gettext-tools/tests/xgettext-appdata-2: New file, based on
gettext-tools/tests/msgfmt-xml-1.
* gettext-tools/tests/Makefile.am (TESTS): Add it.
* gettext-tools/tests/xgettext-its-1: Update expected results.
* gettext-tools/tests/msgfmt-xml-1: Test also character references and entity
references.
* gettext-tools/tests/msgfmt-xml-2: Likewise.
* gettext-tools/doc/gettext.texi (ITS Rules): Under "Escape Special Characters",
explain that it is no longer necessary to write a rule with escape="no".
Rewrite section "Two Use-cases of Translated Strings in XML".
* NEWS: Mention the changes.

9 months agoits: Refactor.
Bruno Haible [Tue, 1 Oct 2024 10:49:01 +0000 (12:49 +0200)] 
its: Refactor.

* gettext-tools/src/its.c (its_rule_list_extract_text): Simplify code
duplication.
(its_merge_context_merge_node): Update accordingly.

9 months agoits: Refactor.
Bruno Haible [Mon, 30 Sep 2024 19:03:47 +0000 (21:03 +0200)] 
its: Refactor.

* gettext-tools/src/its.c (_its_collect_text_content, _its_get_content): Replace
the no_escape parameter with a do_escape parameter.
(its_localization_note_rule_constructor, its_rule_list_extract_text,
its_merge_context_merge_node): All callers changed.

9 months agoits: Refine the XML schema.
Bruno Haible [Mon, 30 Sep 2024 17:38:27 +0000 (19:38 +0200)] 
its: Refine the XML schema.

* gettext-tools/src/its.xsd: Add comments about the default.
* gettext-tools/src/its-extensions.xsd: Likewise.

9 months agoits: Refine the XML schema.
Bruno Haible [Mon, 30 Sep 2024 17:18:51 +0000 (19:18 +0200)] 
its: Refine the XML schema.

* gettext-tools/src/its.xsd: Add string constraints.
* gettext-tools/src/its-extensions.xsd: Likewise.

9 months agoits: Refactor.
Bruno Haible [Mon, 30 Sep 2024 16:44:43 +0000 (18:44 +0200)] 
its: Refactor.

* gettext-tools/src/its.h: Structure this file.
* gettext-tools/src/its.c: Likewise.

9 months agoits: Simplify.
Bruno Haible [Mon, 30 Sep 2024 16:16:22 +0000 (18:16 +0200)] 
its: Simplify.

* gettext-tools/src/its.h: Don't include xg-arglist-context.h.
(its_rule_list_extract): Remove flag_table parameter.
* gettext-tools/src/its.c (its_rule_list_extract_text, its_rule_list_extract):
Remove flag_table parameter.
* gettext-tools/src/xgettext.c (extract_from_xml_file): Update.

9 months agobuild: Add Windows-format metainfo also to libgettextlib and libgettextsrc.
Bruno Haible [Sun, 29 Sep 2024 18:49:51 +0000 (20:49 +0200)] 
build: Add Windows-format metainfo also to libgettextlib and libgettextsrc.

Reported by Michele Locati <mlocati@gmail.com>
at <https://savannah.gnu.org/bugs/index.php?66267>.

* gettext-tools/gnulib-lib/libgettextlib.rc: New file.
* gettext-tools/gnulib-lib/Makefile.am (EXTRA_DIST): Add it.
(WOE32_LIBADD): New macro.
(libgettextlib.res.lo): New rule.
(libgettextlib_la_LIBADD, libgettextlib_la_DEPENDENCIES): Add the .res.lo file.
* gettext-tools/src/libgettextsrc.rc: New file.
* gettext-tools/src/Makefile.am (EXTRA_DIST): Add it.
(WOE32_LIBADD): New macro.
(libgettextsrc.res.lo): New rule.
(libgettextsrc_la_LIBADD, libgettextsrc_la_DEPENDENCIES): New macros.
* gettext-runtime/intl/libintl.rc: Update copyright year.
* gettext-runtime/libasprintf/libasprintf.rc: Likewise.
* gettext-tools/libgettextpo/libgettextpo.rc: Likewise.
* libtextstyle/lib/libtextstyle.rc: Likewise.
* windows/gettext.rc: Likewise.

9 months agobuild: Improve customizations.
Bruno Haible [Sun, 29 Sep 2024 18:39:32 +0000 (20:39 +0200)] 
build: Improve customizations.

* cfg.mk (_autoreconf): Define, to avoid running autoreconf.
(update-copyright-env): Set UPDATE_COPYRIGHT_MAX_LINE_LENGTH to 999, not 79.

9 months agobuild: Fix compilation error on mingw (regression 2024-09-26).
Bruno Haible [Sun, 29 Sep 2024 22:06:43 +0000 (00:06 +0200)] 
build: Fix compilation error on mingw (regression 2024-09-26).

* autogen.sh (GNULIB_MODULES_LIBGETTEXTPO_OTHER): Add mixin/printf-posix.

9 months agoProvide XML schemas for .its and .loc files.
Bruno Haible [Sun, 29 Sep 2024 14:47:30 +0000 (16:47 +0200)] 
Provide XML schemas for .its and .loc files.

Suggested by Martin Blanchard <tchaik@gmx.com>
at <https://savannah.gnu.org/bugs/?56519>.

* gettext-tools/src/its.xsd: New file, reverse-engineered from its.c.
* gettext-tools/src/its-extensions.xsd: New file, reverse-engineered from its.c.
* gettext-tools/src/locating-rules.xsd: New file, reverse-engineered from
locating-rules.c.
* gettext-tools/src/Makefile.am (schemadir): New variable.
(schema_DATA): New variable.
(EXTRA_DIST): Distribute all of schema_DATA.
* gettext-tools/configure.ac: Check for xmllint, and set XMLLINT.
* gettext-tools/its/Makefile.am (ITS_FILES, LOC_FILES): New variables.
(dist_its_DATA): Rewrite.
(check-local): New rule.
* gettext-tools/doc/gettext.texi (Preparing ITS Rules): Split into two
subsections. Mention which schema the files have to obey.
* HACKING: Mention xmllint as maintainer prerequisite.
* PACKAGING: Mention the $prefix/share/gettext/schema/ directory.
* NEWS: Mention the change.

9 months agoRefactor: Rename locating-rule.[hc].
Bruno Haible [Sat, 28 Sep 2024 11:43:00 +0000 (13:43 +0200)] 
Refactor: Rename locating-rule.[hc].

* gettext-tools/src/locating-rules.h: Renamed from gettext-tools/src/locating-rule.h.
* gettext-tools/src/locating-rules.c: Renamed from gettext-tools/src/locating-rule.c.
* gettext-tools/src/FILES: Update.
* gettext-tools/src/Makefile.am (noinst_HEADERS, libgettextsrc_la_SOURCES): Update.
* gettext-tools/src/msgfmt.c: Update.
* gettext-tools/src/xgettext.c: Update.
* gettext-tools/po/POTFILES.in: Update.

9 months agoxgettext: JavaScript: Support customized handling of tagged template literals.
Bruno Haible [Sat, 28 Sep 2024 00:09:36 +0000 (02:09 +0200)] 
xgettext: JavaScript: Support customized handling of tagged template literals.

Reported by Evan Welsh <contact@evanwelsh.com>
and Philip Chimento <philip.chimento@gmail.com>
at <https://savannah.gnu.org/bugs/index.php?60027>.

* gettext-tools/src/str-list.h (string_list_append_move): New declaration.
* gettext-tools/src/str-list.c (string_list_append_move): New function.
* gettext-tools/src/x-javascript.h (x_javascript_tag): New declaration.
* gettext-tools/src/x-javascript.c: Include str-list.h.
(tag_step1_fn): New type.
(gnome_step1, get_tag_step1_fn): New functions.
(struct tag_definition): New type.
(tags): New variable.
(x_javascript_tag): New function.
(struct token_ty): Add fields template_tag, template_parts.
(free_token): Update.
(struct level_info): New type.
(levels): Change element type to 'struct level_info'.
(new_level, level_type): Update.
(phase5_get, x_javascript_lex): Arrange to collect the parts of a template
literal in the last token's template_parts field.
(extract_balanced): Handle tagged template literals.
* gettext-tools/src/xgettext.c (long_options): Add option --tag.
(main): Handle option --tag.
(usage): Document ption --tag.
* gettext-tools/tests/xgettext-javascript-13: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.
* gettext-tools/doc/gettext.texi (No string concatenation): Mention the tagged
template literals as alternative.
* gettext-tools/doc/xgettext.texi: Document the --tag option.
* gettext-tools/doc/lang-javascript.texi (JavaScript): Mention the tagged
template literals syntax.
* NEWS: Mention the change.

9 months agoxgettext: JavaScript: Recognize template literals inside JSX.
Bruno Haible [Thu, 26 Sep 2024 23:47:54 +0000 (01:47 +0200)] 
xgettext: JavaScript: Recognize template literals inside JSX.

* NEWS: Mention the change in the last commit.

9 months agoxgettext: JavaScript: Recognize template literals inside JSX.
Bruno Haible [Thu, 26 Sep 2024 23:11:15 +0000 (01:11 +0200)] 
xgettext: JavaScript: Recognize template literals inside JSX.

Reported by whiteinge <gnu-savannah@eseth.com>
at <https://savannah.gnu.org/bugs/?58407>
and by tuberry and Gianni Lerro <glerro@pm.me>
at <https://savannah.gnu.org/bugs/?62203>.

* gettext-tools/src/x-javascript.c (enum level_ty): New enum.
(levels, levels_alloc, level): New variables.
(new_level): New function.
(level_type): New macro.
(template_literal_depth, brace_depths, brace_depths_alloc): Remove variables.
(new_brace_depth_level): Remove function.
(xml_element_depth, inside_embedded_js_in_xml): Remove variables.
(phase5_get): Use the levels stack instead of the separate stack for braces and
XML.
(extract_javascript): Update.
* gettext-tools/tests/xgettext-javascript-6: Add test cases that mix JSX with
template literals.

9 months agoUpgrade to libtool 2.5.3.
Bruno Haible [Thu, 26 Sep 2024 17:34:46 +0000 (19:34 +0200)] 
Upgrade to libtool 2.5.3.

* m4/libtool.m4: Update from libtool-2.5.3.
* m4/ltoptions.m4: Likewise.
* m4/ltsugar.m4: Likewise.
* m4/ltversion.m4: Likewise.
* m4/lt~obsolete.m4: Likewise.
* build-aux/ltmain.sh: Likewise.

9 months agoxgettext: PHP: Optimize.
Bruno Haible [Thu, 26 Sep 2024 12:09:42 +0000 (14:09 +0200)] 
xgettext: PHP: Optimize.

* gettext-tools/src/x-php.c (process_heredoc): Remove function.
(phase4_get): Inline it here.

9 months agoxgettext: PHP: Revert recently introduced code duplication.
Bruno Haible [Thu, 26 Sep 2024 12:03:46 +0000 (14:03 +0200)] 
xgettext: PHP: Revert recently introduced code duplication.

* gettext-tools/src/x-php.c (process_dquote_or_heredoc): New function, extracted
from process_heredoc.
(process_heredoc): Allocate a php_extractor on the stack. Invoke
process_dquote_or_heredoc.
(phase4_get): Invoke process_dquote_or_heredoc.

9 months agoModernize: Use gnulib's string-buffer module for accumulating strings.
Bruno Haible [Thu, 26 Sep 2024 00:30:57 +0000 (02:30 +0200)] 
Modernize: Use gnulib's string-buffer module for accumulating strings.

* autogen.sh (GNULIB_MODULES_RUNTIME_FOR_SRC, GNULIB_MODULES_TOOLS_FOR_SRC): Add
xstring-buffer.
* gettext-runtime/src/envsubst.c: Include string-buffer.h.
(subst_from_stdin): Use a stack-allocated string_buffer instead of 3 local
variables and micro-optimized ad-hoc code.
* gettext-tools/src/cldr-plural.y: Include string-buffer.h.
(yylex): Use a stack-allocated string_buffer instead of 3 local variables and
micro-optimized ad-hoc code.
* gettext-tools/src/cldr-plurals.c: Include string-buffer.h instead of xalloc.h.
(extract_rules): Use a stack-allocated string_buffer instead of 3 local
variables and micro-optimized ad-hoc code.
* gettext-tools/src/its.c: Include string-buffer.h.
(_its_collect_text_content): Use a stack-allocated string_buffer instead of 3
local variables and micro-optimized ad-hoc code.
* gettext-tools/src/read-desktop.c: Include string-buffer.h.
(desktop_lex): Use a stack-allocated string_buffer instead of 3 local variables
and micro-optimized ad-hoc code.
* gettext-tools/src/read-properties.c: Include string-buffer.h.
(properties_parse): Use a stack-allocated string_buffer instead of 3 local
variables and micro-optimized ad-hoc code.
* gettext-tools/src/x-awk.c: Include string-buffer.h.
(phase2_getc, phase3_get): Use a stack-allocated string_buffer instead of 3
local variables and micro-optimized ad-hoc code.
* gettext-tools/src/x-c.c: Include string-buffer.h.
(phase5_get): Use a stack-allocated string_buffer instead of 3 local variables
and micro-optimized ad-hoc code.
* gettext-tools/src/x-java.c: Include string-buffer.h.
(phase5_get): Use a stack-allocated string_buffer instead of 3 local variables
and micro-optimized ad-hoc code.
* gettext-tools/src/x-javascript.c: Include string-buffer.h.
(phase5_get): Use a stack-allocated string_buffer instead of 3 local variables
and micro-optimized ad-hoc code.
* gettext-tools/src/x-lua.c: Include string-buffer.h.
(string_buf_length, string_buf_alloc, string_buf): Remove variables.
(string_start, string_add, string_end): Remove functions.
(phase3_get): Use a stack-allocated string_buffer instead of 3 local variables
and micro-optimized ad-hoc code.
* gettext-tools/src/x-perl.c: Include string-buffer.h.
(get_here_document, phase2_getc, extract_quotelike_pass1,
extract_quotelike_pass3, extract_variable, interpolate_keywords, x_perl_prelex):
Use a stack-allocated string_buffer instead of 3 local variables and
micro-optimized ad-hoc code.
* gettext-tools/src/x-php.c: Include string-buffer.h.
(process_heredoc, phase4_get): Use a stack-allocated string_buffer instead of 3
local variables and micro-optimized ad-hoc code.
* gettext-tools/src/x-python.c: Include string-buffer.h.
(phase5_get): Use a stack-allocated string_buffer instead of 3 local variables
and micro-optimized ad-hoc code.
* gettext-tools/src/x-rst.c: Include string-buffer.h.
(buffer, bufmax): Remove variables.
(buffer): New variable.
(extract_rst, parse_integer): Use a stack-allocated string_buffer instead of 3
local variables and micro-optimized ad-hoc code.
(extract_rsj): Update.
* gettext-tools/src/x-smalltalk.c: Include string-buffer.h.
(phase2_get): Use a stack-allocated string_buffer instead of 3 local variables
and micro-optimized ad-hoc code.
* gettext-tools/src/x-vala.c: Include string-buffer.h.
(phase3_get): Use a stack-allocated string_buffer instead of 3 local variables
and micro-optimized ad-hoc code.
* gettext-tools/src/x-ycp.c: Include string-buffer.h.
(phase2_getc, phase5_get): Use a stack-allocated string_buffer instead of 3
local variables and micro-optimized ad-hoc code.

9 months agoxgettext: Perl: Fix a bug when reading here documents in a non-UTF-8 encoding.
Bruno Haible [Wed, 25 Sep 2024 20:18:31 +0000 (22:18 +0200)] 
xgettext: Perl: Fix a bug when reading here documents in a non-UTF-8 encoding.

* gettext-tools/src/xgettext.c (get_here_document): Update read_bytes when
switching from the original encoding to the UTF-8 encoding.

9 months agoxgettext: Use sf-istream from Gnulib.
Bruno Haible [Tue, 24 Sep 2024 10:38:19 +0000 (12:38 +0200)] 
xgettext: Use sf-istream from Gnulib.

* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add sf-istream.
* gettext-tools/src/x-perl.c: Include sf-istream.h.
(struct perl_extractor): Replace fp, input, input_end fields with a single
sf_istream_t.
(phase1_getc, get_here_document, skip_pod, interpolate_keywords, extract_perl):
Update.
* gettext-tools/src/x-php.c: Include sf-istream.h.
(struct php_extractor): Replace fp, input, input_end fields with a single
sf_istream_t.
(phase1_getc): Simplify.
(process_heredoc, phase4_get, extract_php): Update.

9 months agoUpdate after gnulib changed: Fix deprecation warning.
Bruno Haible [Thu, 26 Sep 2024 02:31:58 +0000 (04:31 +0200)] 
Update after gnulib changed: Fix deprecation warning.

* gettext-tools/src/msgmerge.c (main): Call xcopy_file_preserving instead of
copy_file_preserving.

9 months agobuild: Add support for --enable-relocatable in mingw builds on Cygwin hosts.
Bruno Haible [Thu, 26 Sep 2024 00:47:16 +0000 (02:47 +0200)] 
build: Add support for --enable-relocatable in mingw builds on Cygwin hosts.

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

* gettext-runtime/configure.ac: Invoke gl_BUILD_TO_HOST_BINDIR.
* gettext-runtime/src/Makefile.am (*_CFLAGS): Fix value of INSTALLDIR.
* gettext-tools/configure.ac: Invoke gl_BUILD_TO_HOST_BINDIR,
gl_BUILD_TO_HOST_PKGLIBEXECDIR.
* gettext-tools/src/Makefile.am (*_CPPFLAGS): Fix value of INSTALLDIR.

9 months agogettext.m4: Simplify after gnulib changed.
Bruno Haible [Thu, 26 Sep 2024 00:34:22 +0000 (02:34 +0200)] 
gettext.m4: Simplify after gnulib changed.

* gettext-runtime/m4/gettext.m4 (AM_GNU_GETTEXT): Invoke
gl_BUILD_TO_HOST_LOCALEDIR.

9 months agoUpdate to the newest gnulib.
Bruno Haible [Tue, 24 Sep 2024 10:33:42 +0000 (12:33 +0200)] 
Update to the newest gnulib.

9 months agobuild: Update after gnulib changed.
Bruno Haible [Tue, 24 Sep 2024 18:36:04 +0000 (20:36 +0200)] 
build: Update after gnulib changed.

* gettext-runtime/libasprintf/configure.ac: Remove gt_TYPE_WCHAR_T invocation.

9 months agodoc: Explain how to add advice for translators in the source code.
Bruno Haible [Sat, 21 Sep 2024 14:24:55 +0000 (16:24 +0200)] 
doc: Explain how to add advice for translators in the source code.

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

* gettext-tools/doc/gettext.texi (Translator advice): New node.

9 months agoPHP: Update doc.
Bruno Haible [Sat, 21 Sep 2024 13:32:36 +0000 (15:32 +0200)] 
PHP: Update doc.

* gettext-tools/doc/lang-php.texi: Update.

9 months agoPHP: Support newer format string directives.
Bruno Haible [Sat, 21 Sep 2024 13:11:51 +0000 (15:11 +0200)] 
PHP: Support newer format string directives.

Reported by José Luis Jiménez Fernández <jjimenez@interhost.com> in
<https://lists.gnu.org/archive/html/bug-gettext/2023-05/msg00037.html>.

* gettext-tools/src/format-php.c (format_parse): Treat E, F, g, G, h, H like
e, f.
* gettext-tools/tests/format-php-1: Test the %E, %F, %g, %G, %h, %H directives.
* gettext-tools/tests/format-php-2: Update type compatibility tests.
* NEWS: Mention the change.

9 months agoxgettext: PHP: Support heredoc and nowdoc strings.
Bruno Haible [Sat, 21 Sep 2024 11:05:16 +0000 (13:05 +0200)] 
xgettext: PHP: Support heredoc and nowdoc strings.

Reported:
by Bodo Graumann <mail@bodograumann.de> at <https://savannah.gnu.org/bugs/?27740>,
at <https://savannah.gnu.org/bugs/?35944>,
by Cédric Anne <canne@teclib.com> at <https://savannah.gnu.org/bugs/?62158>.

* gettext-tools/src/x-php.c (TAB_WIDTH): New macro.
(process_heredoc): New function.
(phase4_get): Process the heredoc or nowdoc string, instead of blindly skipping
it.
* gettext-tools/tests/xgettext-php-1: Add tests of heredoc strings with embedded
expressions.
* gettext-tools/tests/xgettext-php-2: Expect spaces before a heredoc end label
to be eaten. Add tests of heredoc strings and nowdoc strings.
* NEWS: Mention the improvement.

9 months agodoc: Expand section about preparing strings.
Bruno Haible [Thu, 19 Sep 2024 21:26:28 +0000 (23:26 +0200)] 
doc: Expand section about preparing strings.

* gettext-tools/doc/gettext.texi (Triggering): Mention a few more Gnulib
modules.
(Preparing Strings): Turn subheadings into subsections.
(No string concatenation): Mention string concatenation operators and
strings with embedded expressions in various programming languages.
* NEWS: Mention it.

9 months agoxgettext: Perl: Recognize strings with embedded expressions.
Bruno Haible [Thu, 19 Sep 2024 21:25:11 +0000 (23:25 +0200)] 
xgettext: Perl: Recognize strings with embedded expressions.

* gettext-tools/src/x-perl.c (enum token_type_ty, token_ty,
struct token_stack_ty): Moved.
(struct perl_extractor): New type.
(fp, linebuf, linebuf_size, linesize, linepos, eaten_here, end_of_file,
last_comment_line, last_non_comment_line, nesting_depth, last_token_type,
token_stack): Remove variables.
(perl_extractor_init_rest): New function.
(phase1_getc): Add a 'struct perl_extractor *' parameter. Read from a string
if fp == NULL.
(phase1_ungetc, get_here_document, skip_pod, phase2_getc, phase2_ungetc,
extract_quotelike_pass1, extract_quotelike_pass1_utf8): Add a
'struct perl_extractor *' parameter.
(extract_perl_input): New declaration.
(extract_quotelike): Add a 'struct perl_extractor *' parameter.
(extract_triple_quotelike): Add a 'struct perl_extractor *' parameter. Remove
mlp parameter.
(extract_quotelike_pass3): Add a 'struct perl_extractor *' parameter.
(extract_variable): Add a 'struct perl_extractor *' parameter. Remove mlp
parameter.
(interpolate_keywords): Likewise. Rename states wait_quote → seen_lbrace,
dquote → lbrace_dquote, squote → lbrace_squote, barekey → lbrace_barekey. Add
handling of bracket-enclosed expressions in strings.
(x_perl_prelex, x_perl_lex): Add a 'struct perl_extractor *' parameter. Remove
mlp parameter.
(x_perl_unlex): Add a 'struct perl_extractor *' parameter.
(collect_message, extract_balanced): Add a 'struct perl_extractor *' parameter.
Remove mlp parameter.
(extract_perl_input): New function, extracted from extract_perl.
(extract_perl): Use it. Create a 'struct perl_extractor'.
* gettext-tools/tests/xgettext-perl-5: Add tests of strings with embedded
expressions.
* NEWS: Mention the change.

9 months agoxgettext: Perl: Report warnings instead of fatal errors.
Bruno Haible [Thu, 19 Sep 2024 10:34:02 +0000 (12:34 +0200)] 
xgettext: Perl: Report warnings instead of fatal errors.

* gettext-tools/doc/lang-perl.texi (Interpolation I, Interpolation II): Say
"unsupported" instead of "invalid". Say "warning" instead of "fatal error".
* gettext-tools/doc/gettext.texi: Update menu.
* gettext-tools/src/x-perl.c (token_type_string_interpol): New enum item.
(token2string): Handle token_type_string_interpol.
(extract_quotelike_pass3): Remove error_level parameter; use IF_SEVERITY_WARNING
instead. Say "unsupported" instead of "invalid". When encountering an
unsupported variable interpolation, change the token's type to
token_type_string_interpol.
(interpolate_keywords): After calling extract_quotelike_pass3, test the token's
type.
(prefer_regexp_over_division): Handle token_type_string_interpol.
(collect_message): Remove error_level parameter; use IF_SEVERITY_WARNING
instead. After calling extract_quotelike_pass3, test the token's type. Possibly
return NULL.
(extract_balanced): Handle token_type_string_interpol. Test the return value of
collect_message.
* NEWS: Mention the change.

9 months agoxgettext: PHP: Code style.
Bruno Haible [Wed, 18 Sep 2024 21:38:48 +0000 (23:38 +0200)] 
xgettext: PHP: Code style.

* gettext-tools/src/x-php.c (phase4_get): Trivial changes.

9 months agoxgettext: PHP: Recognize strings with embedded expressions.
Bruno Haible [Wed, 18 Sep 2024 21:37:32 +0000 (23:37 +0200)] 
xgettext: PHP: Recognize strings with embedded expressions.

* gettext-tools/src/x-php.c (enum token_type_ty, struct token_ty): Moved.
(struct php_extractor): New type.
(fp, phase1_pushback, phase1_pushback_length, phase2_pushback,
phase2_pushback_length, buffer, bufmax, buflen, last_comment_line,
last_non_comment_line, phase3_pushback, phase3_pushback_length,
phase4_pushback, phase4_pushback_length, phase5_last, paren_nesting_depth,
bracket_nesting_depth): Remove variables.
(php_extractor_init_rest): New function.
(extract_php_input): New declaration.
(phase1_getc): Add a 'struct php_extractor *' parameter. Read from a string
if fp == NULL.
(phase1_ungetc, skip_html, comment_start, comment_add, comment_line_end,
phase3_getc, phase3_ungetc): Add a 'struct php_extractor *' parameter.
(phase4_get): Likewise. Add handling of embedded expressions in strings.
(phase4_unget, x_php_lex): Add a 'struct php_extractor *' parameter.
(extract_balanced): Add a 'struct php_extractor *' parameter. Remove mlp
parameter.
(extract_php_input): New function, extracted from extract_php.
(extract_php): Use it. Create a 'struct php_extractor'.
* gettext-tools/tests/xgettext-php-1: Add tests of strings with embedded
expressions.
* NEWS: Mention the change.

9 months agoxgettext: PHP: Disallow character \x7f in identifiers.
Bruno Haible [Wed, 18 Sep 2024 18:26:42 +0000 (20:26 +0200)] 
xgettext: PHP: Disallow character \x7f in identifiers.

* gettext-tools/src/x-php.c (phase4_get): Don't allow character \x7f in symbol
tokens.

9 months agoxgettext: C#: Recognize strings with embedded expressions.
Bruno Haible [Wed, 18 Sep 2024 15:00:04 +0000 (17:00 +0200)] 
xgettext: C#: Recognize strings with embedded expressions.

* gettext-tools/src/x-csharp.c (token_type_template, token_type_ltemplate,
token_type_mtemplate, token_type_rtemplate): New enum items.
(free_token): Treat token_type_template like token_type_string_literal.
(accumulate_escaped): Accept a second delimiter argument. Return the delimiter.
(template_literal_depth, brace_depths, brace_depths_alloc): New variables,
copied from x-javascript.c.
(new_brace_depth_level): New function, copied from x-javascript.c.
(phase6_get): Recognize strings with embedded expressions. Handle braces in a
nested manner.
(extract_parenthesized): Handle the token types token_type_template,
token_type_ltemplate, token_type_mtemplate, token_type_rtemplate.
(extract_csharp): Initialize template_literal_depth and call
new_brace_depth_level.
* gettext-tools/tests/xgettext-csharp-5: Add tests of strings with embedded
expressions.
* NEWS: Mention the change.

9 months agotests: Add xgettext tests regarding strings with embedded expressions.
Bruno Haible [Tue, 17 Sep 2024 22:05:48 +0000 (00:05 +0200)] 
tests: Add xgettext tests regarding strings with embedded expressions.

* gettext-tools/tests/xgettext-sh-1: Add tests of strings with embedded
expressions.
* gettext-tools/tests/xgettext-python-1: Likewise.
* gettext-tools/tests/xgettext-tcl-2: Likewise.
* gettext-tools/tests/xgettext-ruby-2: Likewise.
* gettext-tools/tests/xgettext-javascript-3: Likewise.