]> git.ipfire.org Git - thirdparty/gettext.git/log
thirdparty/gettext.git
10 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.

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

10 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.

10 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.

10 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.

10 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>.

10 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.

10 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.

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

10 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.

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

10 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.

10 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.

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

10 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.

10 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.

10 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.

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

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

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

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 months agoUpdate copyright year.
Bruno Haible [Mon, 16 Sep 2024 16:45:27 +0000 (18:45 +0200)] 
Update copyright year.

10 months agobuild: Fix "make distcheck" after the line-breaking algorithm changed.
Bruno Haible [Mon, 16 Sep 2024 16:43:22 +0000 (18:43 +0200)] 
build: Fix "make distcheck" after the line-breaking algorithm changed.

* gettext-runtime/po/Makefile.in.in (.po.gmo, $(POFILES)): In the gettext-tools
package, when not cross-compiling, use the locally built msg* programs.
* gettext-tools/configure.ac: When not cross-compiling, set MSGMERGE and
MSGMERGE_FOR_MSGFMT_OPTION to point to locally built msgmerge program.

10 months agotests: Fix a test failure.
Bruno Haible [Mon, 16 Sep 2024 14:00:53 +0000 (16:00 +0200)] 
tests: Fix a test failure.

* gettext-tools/tests/xgettext-ruby-2: Skip the test if 'rxgettext' is not
found.

10 months agoUpdate after gnulib changed.
Bruno Haible [Sun, 15 Sep 2024 22:47:22 +0000 (00:47 +0200)] 
Update after gnulib changed.

* gettext-tools/tests/msgmerge-28: Update expected test result.
* gettext-tools/tests/mm-viet.out: Likewise.

10 months agoUpdate to the newest gnulib.
Bruno Haible [Sun, 15 Sep 2024 21:21:14 +0000 (23:21 +0200)] 
Update to the newest gnulib.

10 months agotests: Add xgettext tests regarding string concatenation.
Bruno Haible [Wed, 11 Sep 2024 12:20:57 +0000 (14:20 +0200)] 
tests: Add xgettext tests regarding string concatenation.

* gettext-tools/tests/xgettext-sh-1: Add string concatenation tests.
* gettext-tools/tests/xgettext-lua-1: Add a string concatenation test.
* gettext-tools/tests/xgettext-vala-1: Likewise.
* gettext-tools/tests/xgettext-javascript-3: Enhance the string concatenation
test.
* gettext-tools/tests/xgettext-csharp-5: Update comment.
* gettext-tools/tests/xgettext-csharp-6: Likewise.
* gettext-tools/tests/xgettext-java-5: Likewise.
* gettext-tools/tests/xgettext-java-6: Likewise.
* gettext-tools/tests/xgettext-lua-2: Likewise.
* gettext-tools/tests/xgettext-perl-7: Likewise.
* gettext-tools/tests/xgettext-php-3: Likewise.
* gettext-tools/tests/xgettext-python-1: Likewise.
* gettext-tools/tests/xgettext-python-2: Likewise.
* gettext-tools/tests/xgettext-python-4: Likewise.
* gettext-tools/tests/xgettext-ruby-1: Likewise.
* gettext-tools/tests/xgettext-sh-5: Likewise.
* gettext-tools/tests/xgettext-ruby-2: New file, based on
gettext-tools/tests/xgettext-csharp-6.
* gettext-tools/tests/Makefile.am (TESTS): Add it.

10 months agoxgettext: awk: Recognize string concatenation.
Bruno Haible [Wed, 11 Sep 2024 12:09:34 +0000 (14:09 +0200)] 
xgettext: awk: Recognize string concatenation.

* gettext-tools/src/x-awk.c (SIZEOF): New macro.
(phase3_pushback, phase3_pushback_length): New variables.
(phase3_get): Renamed from x_awk_lex. Return pushed-back token if present.
(phase3_unget): New function.
(string_concat_free1): New function.
(phase4_get): New function.
(extract_parenthesized): Invoke phase4_get instead of x_awk_lex.
(extract_awk): Initialize phase3_pushback_length.
* gettext-tools/tests/xgettext-awk-1: Add test cases for string concatenation.
* NEWS: Mention the improvement.

10 months agoxgettext: Smalltalk: Recognize string concatenation.
Bruno Haible [Wed, 11 Sep 2024 12:09:29 +0000 (14:09 +0200)] 
xgettext: Smalltalk: Recognize string concatenation.

* gettext-tools/src/x-smalltalk.c (struct token_ty): Add field 'comment'.
(free_token): New function.
(phase2_get): Fill in tp->comment.
(phase3_pushback): Increase size.
(phase3_get): Fill in tp->comment. Do reference counting.
(string_concat_free1): New function.
(phase4_pushback, phase4_pushback_length): New variables.
(phase4_get, phase4_unget): New functions.
(extract_smalltalk): Initialize phase4_pushback_length. Call phase4_get instead
of phase3_get, phase4_unget instead of phase3_unget. Use the comment stored in
the token. Call free_token.
* gettext-tools/tests/xgettext-smalltalk-1: Add a test case of string
concatenation.
* NEWS: Mention the improvement.

10 months agoxgettext: Ruby: Make the --omit-header option work.
Bruno Haible [Wed, 11 Sep 2024 12:09:24 +0000 (14:09 +0200)] 
xgettext: Ruby: Make the --omit-header option work.

* gettext-tools/src/x-ruby.c (is_not_header): New function.
(extract_ruby): If --omit-header is specified, remove the header entry at the
end.

10 months agoxgettext: Refactor.
Bruno Haible [Wed, 11 Sep 2024 12:09:08 +0000 (14:09 +0200)] 
xgettext: Refactor.

* gettext-tools/src/x-awk.c (SE_QUOTES): Renamed from P7_QUOTES.
(get_string_element): Renamed from phase7_getc.
(x_awk_lex): Update.
* gettext-tools/src/x-c.c (SE_EOF): Renamed from P7_EOF.
(SE_QUOTES): Renamed from P7_QUOTES.
(SE_QUOTE): Renamed from P7_QUOTE.
(SE_NEWLINE): Renamed from P7_NEWLINE.
(get_string_element): Renamed from phase7_getc.
(unget_string_element): Renamed from phase7_ungetc.
(phase5_get): Update.
* gettext-tools/src/x-vala.c (SE_EOF): Renamed from P7_EOF.
(SE_QUOTES): Renamed from P7_QUOTES.
(SE_QUOTE): Renamed from P7_QUOTE.
(SE_NEWLINE): Renamed from P7_NEWLINE.
(get_string_element): Renamed from phase7_getc.
(unget_string_element): Renamed from phase7_ungetc.
(phase3_get): Update.
* gettext-tools/src/x-ycp.c (SE_QUOTES): Renamed from P7_QUOTES.
(get_string_element): Renamed from phase7_getc.
(phase5_get): Update.

11 months agodoc: Document the <inttypes.h> macros for translators.
Bruno Haible [Tue, 10 Sep 2024 15:12:28 +0000 (17:12 +0200)] 
doc: Document the <inttypes.h> macros for translators.

Reported by Mingye Wang <arthur200126@gmail.com>
at <https://savannah.gnu.org/bugs/?66195>.

* gettext-tools/doc/gettext.texi (c-format, objc-format): Mention the
<inttypes.h> macro placeholders.

11 months agobuild: Fix build failure when people set DESTDIR already during 'make'.
Bruno Haible [Tue, 10 Sep 2024 11:41:03 +0000 (13:41 +0200)] 
build: Fix build failure when people set DESTDIR already during 'make'.

Reported by Henrik Holst <henrik.holst@outlook.com> in
<https://lists.gnu.org/archive/html/bug-gettext/2024-09/msg00005.html>.

* gettext-tools/src/Makefile.am (textstyle.h): Pass an empty DESTDIR to
libtextstyle/lib/Makefile.

11 months agodoc: Discourage --omit-header.
Bruno Haible [Tue, 10 Sep 2024 09:28:28 +0000 (11:28 +0200)] 
doc: Discourage --omit-header.

* gettext-tools/doc/msgcomm.texi: Document the effects of --omit-header.
* gettext-tools/doc/xgettext.texi: Likewise.

11 months agoxgettext: Deprecate --trigraphs.
Bruno Haible [Tue, 10 Sep 2024 09:38:42 +0000 (11:38 +0200)] 
xgettext: Deprecate --trigraphs.

* gettext-tools/src/xgettext.c (usage): Mark option --trigraphs as deprecated.
* gettext-tools/doc/xgettext.texi: Likewise.

11 months agoxgettext: C: Fix undefined behaviour.
Bruno Haible [Tue, 10 Sep 2024 01:58:05 +0000 (03:58 +0200)] 
xgettext: C: Fix undefined behaviour.

* gettext-tools/src/x-c.c (phase7_getc): Declare n as 'unsigned int', to avoid
signed integer overflow.
* gettext-tools/tests/xg-c-escape-3.c: Add two more test cases.
* gettext-tools/tests/xgettext-c-escape-3: Update expected test result.

11 months agoDrop workarounds for glibc 2.1 and Solaris 9.
Bruno Haible [Mon, 9 Sep 2024 14:10:31 +0000 (16:10 +0200)] 
Drop workarounds for glibc 2.1 and Solaris 9.

* gettext-tools/src/read-po-lex.c (po_lex_charset_set): Remove glibc 2.1 and
Solaris 9 workarounds.
* gettext-tools/src/recode-sr-latin.c (process): Likewise.
* gettext-tools/src/write-po.c (wrap): Likewise.
* gettext-tools/src/x-python.c (set_current_file_source_encoding): Likewise.
* gettext-tools/src/xgettext.c (main): Likewise.
* libtextstyle/gnulib-local/lib/iconv-ostream.oo.c (iconv_ostream::free,
iconv_ostream_create): Likewise.

11 months agodoc: Add comments.
Bruno Haible [Sun, 8 Sep 2024 08:04:53 +0000 (10:04 +0200)] 
doc: Add comments.

* gettext-tools/doc/lang-sh.texi: Add a comment.

11 months agodoc: Enhance doc about format strings in JavaScript.
Bruno Haible [Sun, 8 Sep 2024 08:02:23 +0000 (10:02 +0200)] 
doc: Enhance doc about format strings in JavaScript.

* gettext-tools/doc/lang-javascript.texi (JavaScript): Document how to get a
decent 'format' method.

11 months agodoc: Update regarding PO file editors.
Bruno Haible [Sun, 8 Sep 2024 15:25:27 +0000 (17:25 +0200)] 
doc: Update regarding PO file editors.

* gettext-tools/doc/gettext.texi (Editing): Add some text.
(Web based localization): New section.
(Lokalize): Renamed from KBabel. Add some text.
(Gtranslator): Add some text.
(Poedit): New section.

11 months agodoc: Fix formatting with texi2html.
Bruno Haible [Sun, 8 Sep 2024 07:58:39 +0000 (09:58 +0200)] 
doc: Fix formatting with texi2html.

* gettext-tools/doc/gettext.texi: Write '@itemize @bullet', not just '@itemize'.
* gettext-tools/doc/xgettext.texi: Likewise.

11 months agoReplace FSF snail-mail addresses with URLs.
Bruno Haible [Sun, 1 Sep 2024 13:58:21 +0000 (15:58 +0200)] 
Replace FSF snail-mail addresses with URLs.

* build-aux/texi2html: Update GPL license notice.

11 months agoUpdate translators' disclaimer.
Bruno Haible [Sun, 1 Sep 2024 13:48:26 +0000 (15:48 +0200)] 
Update translators' disclaimer.

* gettext-tools/misc/DISCLAIM: Untabify. Integrate some changes from the
FSF (2010).

11 months agobuild: Fix shared library support in 32-bit mode on FreeBSD/powerpc64.
Bruno Haible [Sat, 24 Aug 2024 13:52:05 +0000 (15:52 +0200)] 
build: Fix shared library support in 32-bit mode on FreeBSD/powerpc64.

Patch from <https://savannah.gnu.org/patch/index.php?10469>.

* m4/libtool.m4: On FreeBSD, fix shlibpath_var.

11 months agoxgetcwd: Port to native Windows.
Bruno Haible [Wed, 21 Aug 2024 07:18:22 +0000 (09:18 +0200)] 
xgetcwd: Port to native Windows.

Use a variant of the gnulib module 'xgetcwd' instead of our own (older) one.

* gnulib-local/lib/xgetcwd.h: Remove file.
* gnulib-local/lib/xgetcwd.c: Remove file.
* gnulib-local/modules/xgetcwd: Remove file.
* gnulib-local/modules/xgetcwd.diff: New file.
* gnulib-local/Makefile.am (EXTRA_DIST): Update.

11 months agomsgfmt: Tcl: Produce the same output on native Windows as elsewhere.
Bruno Haible [Tue, 20 Aug 2024 13:30:23 +0000 (15:30 +0200)] 
msgfmt: Tcl: Produce the same output on native Windows as elsewhere.

* gettext-tools/src/write-tcl.c (msgdomain_write_tcl): Invoke fopen with 'b'
flag, so as to force Unix newlines.

11 months agoxgettext: Scheme: Recognize datum-comments, part 2.
Bruno Haible [Tue, 20 Aug 2024 09:48:37 +0000 (11:48 +0200)] 
xgettext: Scheme: Recognize datum-comments, part 2.

* gettext-tools/src/x-scheme.c (read_object): Avoid reference to uninitialized
variable context_iter for arg > 0.

11 months agotests: Improve portability.
Bruno Haible [Fri, 16 Aug 2024 23:50:27 +0000 (01:50 +0200)] 
tests: Improve portability.

* gettext-tools/tests/lang-javascript: Don't use '${DIFF} -u', since AIX diff
does not support the -u option.
* gettext-tools/tests/xgettext-vala-6: Likewise.

11 months agoxgettext: Scheme: Recognize hexadecimal escape sequences in string literals.
Bruno Haible [Fri, 16 Aug 2024 23:29:02 +0000 (01:29 +0200)] 
xgettext: Scheme: Recognize hexadecimal escape sequences in string literals.

* gettext-tools/src/x-scheme.c (accumulate_escaped): Recognize \x, \u, \U escape
sequences.
* gettext-tools/tests/xgettext-scheme-7: Test also some \x escape sequences.
* gettext-tools/tests/xgettext-scheme-8: Test also some \x, \u, \U escape
sequences.

11 months agoxgettext: Scheme: Prepare for recognizing more escape sequences in string literals.
Bruno Haible [Fri, 16 Aug 2024 21:44:53 +0000 (23:44 +0200)] 
xgettext: Scheme: Prepare for recognizing more escape sequences in string literals.

* gettext-tools/src/x-scheme.c (accumulate_escaped): New function, extracted
from read_object.
(struct object): Add field 'mixed_string'.
(free_object): Free field 'mixed_string'.
(string_of_object): Implement differently for objects of type t_string.
(read_object): Use accumulate_escaped. Invoke mixed_string_alloc_utf8 instead of
mixed_string_alloc_simple.

11 months agoxgettext: Scheme: In language Scheme, handle backslash-newline as specified in R6RS.
Bruno Haible [Fri, 16 Aug 2024 20:40:10 +0000 (22:40 +0200)] 
xgettext: Scheme: In language Scheme, handle backslash-newline as specified in R6RS.

Reported by Florent Angly <florent.angly@gmail.com>
at <https://savannah.gnu.org/bugs/?59262>.

* gettext-tools/src/x-scheme.c (read_object): Do R6RS-compliant interpretation
of backslash-newline if follow_guile is false.
* gettext-tools/tests/xgettext-scheme-7: New file.
* gettext-tools/tests/xgettext-scheme-8: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add them.

11 months agoxgettext: Scheme: #!fold-case and #!no-fold-case directives.
Bruno Haible [Fri, 16 Aug 2024 20:36:30 +0000 (22:36 +0200)] 
xgettext: Scheme: #!fold-case and #!no-fold-case directives.

Reported by Florent Angly <florent.angly@gmail.com>
at <https://savannah.gnu.org/bugs/?61987>.

* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add unicase/u8-casefold,
uninorm/nfc.
* gettext-tools/src/x-scheme.c: Include unicase.h, uninorm.h.
(SIZEOF): New macro.
(phase0_getc): Renamed from do_getc. Remove line_number handling.
(phase0_ungetc): Renamed from do_ungetc. Remove line_number handling.
(MAX_PHASE1_PUSHBACK): New macro.
(phase1_pushback, phase1_pushback_length): New variables.
(phase1_getc, phase1_ungetc): New functions.
(casefold): New variable.
(read_token): Use phase1_getc, phase1_ungetc instead of do_getc, do_ungetc.
(read_object): Likewise. If casefold is true, apply Unicode case-folding to
symbols before looking them up in the hash table. Recognize all #! directives
supported by Guile.
(extract_whole_file): Initialize phase1_pushback_length, casefold.
* gettext-tools/tests/xgettext-scheme-6: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.

11 months agoxgettext: Scheme: Recognize datum-comments.
Bruno Haible [Fri, 16 Aug 2024 20:32:58 +0000 (22:32 +0200)] 
xgettext: Scheme: Recognize datum-comments.

Reported by Florent Angly <florent.angly@gmail.com>
at <https://savannah.gnu.org/bugs/?61882>.

* gettext-tools/src/x-scheme.c (datum_comment_nesting_depth): New variable.
(read_object): Omit the normal processing of list elements if
datum_comment_nesting_depth is non-zero. Recognize datum comments.
(extract_whole_file): Initialize datum_comment_nesting_depth.
* gettext-tools/tests/xgettext-scheme-1: Add a test case with a datum comment.
* NEWS: Mention the change.

11 months agoxgettext: Scheme: Understand both '-L Scheme' and '-L Guile'.
Bruno Haible [Fri, 16 Aug 2024 19:05:47 +0000 (21:05 +0200)] 
xgettext: Scheme: Understand both '-L Scheme' and '-L Guile'.

* gettext-tools/src/x-scheme.h (EXTENSIONS_SCHEME): Associate the language
Guile, not Scheme, with the extension .scm.
(SCANNERS_SCHEME): Add info about the 'Guile' language.
(extract_guile): New declaration.
* gettext-tools/src/x-scheme.c (follow_guile): New variable.
(extract_whole_file): Renamed from extract_scheme.
(extract_scheme, extract_guile): New functions.
* gettext-tools/src/xgettext.c (usage): List Guile as a possible argument for
the '-L' option.
* gettext-tools/doc/xgettext.texi: Document 'Guile' as possible argument for
the '-L' option.
* gettext-tools/doc/lang-scheme.texi (Scheme): Explain the difference between
'-L Scheme' and '-L Guile'.
* NEWS: Mention the change.

11 months agoxgettext: Scheme: More tests.
Bruno Haible [Fri, 16 Aug 2024 19:04:21 +0000 (21:04 +0200)] 
xgettext: Scheme: More tests.

* gettext-tools/tests/xgettext-scheme-5: New file, based on
gettext-tools/tests/xgettext-5.
* gettext-tools/tests/Makefile.am (TESTS): Add it.

11 months agoxgettext: Scheme: Reorganize tests.
Bruno Haible [Fri, 16 Aug 2024 18:53:13 +0000 (20:53 +0200)] 
xgettext: Scheme: Reorganize tests.

* gettext-tools/tests/xgettext-scheme-format-1: Renamed from
gettext-tools/tests/xgettext-scheme-5.
* gettext-tools/tests/xgettext-scheme-format-2: Renamed from
gettext-tools/tests/xgettext-scheme-6.
* gettext-tools/tests/Makefile.am (TESTS): Update.

11 months agomsginit: Update information about zh_TW translation team.
Bruno Haible [Fri, 16 Aug 2024 14:54:49 +0000 (16:54 +0200)] 
msginit: Update information about zh_TW translation team.

Reported by Buug Worm <buugworm@gmail.com>
at <https://savannah.gnu.org/bugs/?66094>.

* gettext-tools/projects/KDE/teams.url: Update URL.
* gettext-tools/projects/KDE/teams.html: Update information about zh_TW
translation team.
* gettext-tools/projects/TP/teams.html: Likewise.

11 months agotests: Prefer 'cat <<\EOF' to 'cat <<EOF' whenever possible.
Bruno Haible [Fri, 16 Aug 2024 08:36:06 +0000 (10:36 +0200)] 
tests: Prefer 'cat <<\EOF' to 'cat <<EOF' whenever possible.

Rationale: Not interpreting $ and \ in the here documents is a better default
than interpreting them.

* gettext-tools/tests/*: Write 'cat <<\EOF' instead of 'cat <<EOF', when no
shell dollar-substitution and backslash-interpretation is needed.

11 months agoxgettext: Python: Change escape sequences interpretation to follow Python 3.
Bruno Haible [Wed, 14 Aug 2024 16:18:37 +0000 (18:18 +0200)] 
xgettext: Python: Change escape sequences interpretation to follow Python 3.

Reported by Serhii Tereshchenko <serg.partizan@gmail.com> at
<https://savannah.gnu.org/bugs/?65778>.

* gettext-tools/src/x-python.c (phase7_getuc): Update comments for Python 3.
Don't interpret \u sequences in raw bytes and raw strings.
(phase5_get): Recognize bytes prefixes 'b' and 'B'. For f-strings, invoke
phase7_getuc with interpret_unicode = true, not false.
* gettext-tools/tests/xgettext-python-1: Update for Python 3.
* gettext-tools/tests/xgettext-python-5: Likewise.
* NEWS: Mention the change.

11 months agoImprove handling of non-BMP characters with Tcl 9.0.
Bruno Haible [Mon, 12 Aug 2024 20:06:10 +0000 (22:06 +0200)] 
Improve handling of non-BMP characters with Tcl 9.0.

* gettext-tools/src/write-tcl.c (hexdigit): New variable.
(write_tcl8_string): Renamed from write_tcl_string. Enable the escaping of
braces.
(write_tcl9_string, is_entirely_ucs2, write_tcl_string): New functions.
* gettext-tools/tests/msgfmt-tcl-1: New file.
* gettext-tools/tests/testdata/tcltest_pl.po: New file.
* gettext-tools/tests/testdata/tcltest_pl.msg: New file.
* gettext-tools/tests/msgfmt-tcl-2: New file.
* gettext-tools/tests/testdata/tcltest_cs.po: New file.
* gettext-tools/tests/testdata/tcltest_cs.msg: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add msgfmt-tcl-1, msgfmt-tcl-2.
(EXTRA_DIST): Add the new testdata files.
* NEWS: Mention the change.

11 months agolibintl: Remove conditionals for libglocale.
Bruno Haible [Mon, 12 Aug 2024 11:09:56 +0000 (13:09 +0200)] 
libintl: Remove conditionals for libglocale.

libglocale was a short-lived project in 2005 that was never completed.

* gettext-runtime/intl/dcigettext.c: Assume IN_LIBGLOCALE is not defined.
* gettext-runtime/intl/libgnuintl.in.h: Likewise.
* gettext-runtime/intl/loadmsgcat.c: Likewise.
* gettext-runtime/intl/localealias.c: Likewise.
* gettext-runtime/intl/plural-exp.h: Likewise.
* gettext-runtime/intl/gettextP.h: Likewise.
(gl_dcigettext): Remove declaration.
* gettext-runtime/intl/Makefile.am (libgnuintl.h, libintl.h): Remove the
IN_LIBGLOCALE handling.

11 months agobuild: Update .gitignore: Automake no longer needs or installs elisp-comp.
Bruno Haible [Mon, 12 Aug 2024 11:09:33 +0000 (13:09 +0200)] 
build: Update .gitignore: Automake no longer needs or installs elisp-comp.