Bruno Haible [Wed, 28 Jan 2026 23:47:27 +0000 (00:47 +0100)]
examples: Use infrastructure from gettext version 1.0.
* gettext-tools/examples/hello-*/configure.ac: Use AM_GNU_GETTEXT_VERSION with
version 1.0.
* gettext-tools/examples/hello-c++-kde/configure.in.in: Likewise.
* gettext-tools/examples/hello-*/autogen.sh: Copy remove-potcdate.sed from the
new location in the source tree. Copy also the no-op fetch-po.
* gettext-tools/examples/hello-*/autoclean.sh: Remove also fetch-po.
Bruno Haible [Wed, 28 Jan 2026 12:50:21 +0000 (13:50 +0100)]
xgettext: PHP: Fix parsing of strings and heredocs with embedded expressions.
Reported by Gert Jan Schoneveld <gertjan@facilityapps.com> in
<https://lists.gnu.org/archive/html/bug-gettext/2025-08/msg00007.html>
and by Benoit Waldmann <benoit.waldmann@siagilus.fr>
at <https://savannah.gnu.org/bugs/index.php?item_id=67948>.
* gettext-tools/src/x-php.c (enum token_type_ty): New enum values
token_type_lbrace, token_type_rbrace.
(struct php_extractor): New field brace_nesting_depth.
(php_extractor_init_rest): Initialize it.
(extract_balanced): Forward-declare.
(process_dquote_or_heredoc): Change handling of embedded expressions.
(phase4_get): Recognize token_type_lbrace, token_type_rbrace.
(extract_balanced): Recurse also for token_type_lbrace.
(extract_php_input): Remove function.
(extract_php): Inline it here.
* gettext-tools/tests/xgettext-php-1: Add more tests of embedded expressions.
Bruno Haible [Tue, 27 Jan 2026 05:03:04 +0000 (06:03 +0100)]
po-mode: Prepare for inclusion in GNU ELPA.
Suggested by Stefan Monnier <monnier@iro.umontreal.ca> in
<https://lists.gnu.org/archive/html/bug-gettext/2026-01/msg00086.html>.
* gettext-tools/emacs/po-mode.el: Add meta-information field 'Version:',
required by ELPA. Move meta-information after the copyright and license notice.
(po-mode-version-string): Move definition.
* gettext-tools/emacs/po-compat.el: Move meta-information after the copyright
and license notice. Convert the file to UTF-8 encoding.
Bruno Haible [Sun, 25 Jan 2026 18:17:48 +0000 (19:17 +0100)]
Fix a small memory leak in libgettextpo.
Reported by <gemmaro.dev@gmail.com> at
<https://savannah.gnu.org/bugs/index.php?item_id=67892>
and by Albert Astals Cid <aacid@kde.org> in
<https://lists.gnu.org/archive/html/bug-gettext/2026-01/msg00071.html>.
* gettext-tools/src/read-po-lex.h: Include str-list.h.
(lex_start): Add arena parameter.
* gettext-tools/src/read-po-lex.c (lex_start): Add arena parameter. Add the
heap-allocated file_name to the arena.
* gettext-tools/src/read-catalog-abstract.h: Include str-list.h.
(struct catalog_input_format): Add arena parameter to parse() method.
(catalog_reader_parse): Add arena parameter.
* gettext-tools/src/read-properties.c (properties_parse): Add arena parameter.
* gettext-tools/src/read-stringtable.c (stringtable_parse): Add arena parameter.
* gettext-tools/src/read-po.c (po_parse): Add arena parameter. Update lex_start
call.
* gettext-tools/src/read-catalog-abstract.c (catalog_reader_parse): Add arena
parameter. Update parse() method call.
* gettext-tools/src/read-catalog.h: Include str-list.h.
(read_catalog_stream): Add arena parameter.
* gettext-tools/src/read-catalog.c (read_catalog_stream): Add arena parameter.
Update catalog_reader_parse call.
* gettext-tools/src/read-catalog-file.c: Include str-list.h.
(read_catalog_file): Update read_catalog_stream call.
* gettext-tools/src/read-csharp.c: Include str-list.h.
(execute_and_read_po_output): Update read_catalog_stream call.
* gettext-tools/src/read-java.c: Include str-list.h.
(execute_and_read_po_output): Update read_catalog_stream call.
* gettext-tools/src/read-resources.c: Include str-list.h.
(execute_and_read_po_output): Update read_catalog_stream call.
* gettext-tools/src/read-tcl.c: Include str-list.h.
(msgdomain_read_tcl): Update read_catalog_stream call.
* gettext-tools/libgettextpo/gettext-po.c: Include str-list.h.
(struct po_file): Add field 'arena'.
(po_file_create): Initialize it.
(po_file_read): Likewise. Update read_catalog_stream call.
(po_file_free): Destroy the arena.
* gettext-tools/src/msgfmt.c (read_catalog_file_msgfmt): Update
catalog_reader_parse call.
* gettext-tools/src/x-po.c: Include str-list.h.
(extract): Update catalog_reader_parse call.
* gettext-tools/src/xgettext.c (read_exclusion_file): Update
catalog_reader_parse call.
Bruno Haible [Sun, 25 Jan 2026 03:51:32 +0000 (04:51 +0100)]
Fix warnings with gcc 15 and glibc 2.43.
* libtextstyle/gnulib-local/lib/glib/gstrfuncs.in.h (g_strstr_len): Change
return type to 'const gchar *'.
* libtextstyle/gnulib-local/lib/glib/gstrfuncs.c (g_strstr_len): Likewise.
* libtextstyle/gnulib-local/lib/libcroco/cr-rgb.c (cr_rgb_set_from_name): Change
type of 'result'.
* gettext-tools/src/cldr-plurals.c (extract_rules): Cast the sb_xcontents_c
result to 'char *'.
Bruno Haible [Thu, 15 Jan 2026 11:32:43 +0000 (12:32 +0100)]
build: Fix "make installcheck" on MSVC.
Reported by Kirill Makurin <maiddaisuki@outlook.com> in
<https://lists.gnu.org/archive/html/bug-gettext/2026-01/msg00042.html>.
* gettext-runtime/m4/gettext.m4 (AM_GNU_GETTEXT): New variable
INTL_WINDOWS_LIBS. Add it to LIBINTL and LTLIBINTL.
* gettext-runtime/configure.ac (INSTALLED_LIBINTL): Add $INTL_WINDOWS_LIBS.
* gettext-tools/configure.ac (INSTALLED_LIBINTL): Likewise.
* libtextstyle/configure.ac (INSTALLED_LIBTEXTSTYLE): New variable.
* libtextstyle/install-tests/Makefile.am (installcheck-local): Link with
$INSTALLED_LIBTEXTSTYLE instead of -ltextstyle.
Bruno Haible [Sat, 10 Jan 2026 19:16:46 +0000 (20:16 +0100)]
xgettext: Allow inhibiting the warnings about URLs and email addresses.
Reported at <https://savannah.gnu.org/bugs/?67672>.
* gettext-tools/src/message.h (enum syntax_check_type): Add sc_url, sc_email.
(NSYNTAXCHECKS): Increase by 2.
* gettext-tools/src/message.c (syntax_check_name): Update.
* gettext-tools/src/xgettext.h (default_syntax_check): Add comment.
* gettext-tools/src/xgettext.c (default_syntax_check): Add initializer.
(main): Recognize --no-check option.
(usage): Document --no-check option.
* gettext-tools/src/xg-message.c (decide_syntax_check): Assume that
default_syntax_check[i] != undecided.
* gettext-tools/src/xg-check.c (syntax_check_function): Remove the second
argument.
(string_has_ascii_ellipsis): New function, extracted from
syntax_check_ellipsis_unicode.
(message_has_ascii_ellipsis): New function.
(syntax_check_ellipsis_unicode): Remove the second argument. Simplify. Emit only
a single error for both msgid and msgid_plural.
(string_has_space_ellipsis): New function, extracted from
syntax_check_space_ellipsis.
(message_has_space_ellipsis): New function.
(syntax_check_space_ellipsis): Remove the second argument. Simplify. Emit only
a single error for both msgid and msgid_plural.
(syntax_check_quote_unicode): Remove the second argument.
(syntax_check_bullet_unicode_string): New function, extracted from
syntax_check_bullet_unicode.
(syntax_check_bullet_unicode): Remove the second argument. Simplify.
(string_has_url): Don't recognize 'mailto:' URLs.
(syntax_check_url, syntax_check_email): New functions, extracted from
url_check_message.
(url_check_message): Remove function.
(sc_funcs): Add syntax_check_url, syntax_check_email.
(syntax_check_message): Simplify.
(xgettext_check_message_list): Don't invoke url_check_message.
* gettext-tools/tests/xgettext-14: Update after xg-check.c changesd.
* gettext-tools/tests/xgettext-20: Add more testcases.
* gettext-tools/doc/xgettext.texi: Document the --no-check option.
* gettext-tools/doc/gettext.texi: Bump copyright year.
* NEWS: Mention the change.
gemmaro [Thu, 1 Jan 2026 13:29:08 +0000 (22:29 +0900)]
po-mode: Use define-derived-mode for po-subedit-mode.
* gettext-tools/emacs/po-mode.el (po-subedit-mode): Define as derived
mode from text mode using define-derived-mode.
(po-subedit-mode-syntax-table, po-mode-abbrev-table): Remove these
variables, as define-derived-mode creates them automatically.
(po-edit-string): Use po-subedit-mode instead of text-mode. Remove
local abbrev table, keymap, syntax table, and hook invocation, since
define-derived-mode handles these automatically. Move easy-menu
definition to the define-derived-mode body.
(Package-Requires): Add minimum Emacs version requirement. The
define-derived-mode was probably introduced in Emacs 19.23, and commit 7797a29e9 dropped support for Emacs versions before 23.
Bruno Haible [Wed, 31 Dec 2025 00:58:57 +0000 (01:58 +0100)]
Document the relation between fetch-po and version control.
Reported by Simon Josefsson in
<https://lists.gnu.org/archive/html/bug-gettext/2025-12/msg00030.html>.
* gettext-tools/doc/gettext.texi (po/fetch-po): Add a reference.
(Translations under Version Control): Remove subsection.
(PO Template File under Version Control?): New subsection.
(Translations under Version Control?): New subsection.
Bruno Haible [Tue, 30 Dec 2025 23:11:05 +0000 (00:11 +0100)]
po-fetch: Add man page.
Reported by Simon Josefsson in
<https://lists.gnu.org/archive/html/bug-gettext/2025-12/msg00030.html>.
* gettext-tools/man/po-fetch.x: New file.
* gettext-tools/man/po-fetch.1.diff: New file.
* gettext-tools/man/Makefile.am (man_aux): Add po-fetch.x.
(man_MAN1MISC): New variable.
(man_MAN1): Include it.
(man_HTML): Add po-fetch.1.html.
($(man_MAN1MISC)): New rule.
(po-fetch.1, po-fetch.1.html): State dependencies.
* PACKAGING: Update.
Bruno Haible [Fri, 26 Dec 2025 21:50:10 +0000 (22:50 +0100)]
Update ISO 3166 country codes list.
* gettext-tools/doc/ISO_3166: Update to match current Wikipedia.
* gettext-tools/doc/iso-3166.texi: Likewise.
* gettext-tools/src/msginit.c (catalogname_for_locale): Likewise.
Bruno Haible [Mon, 22 Dec 2025 14:05:13 +0000 (15:05 +0100)]
Fix compilation errors with older C compilers (regression 2025-12-19).
* gnulib-local/lib/xerror.c (multiline_internal): Add a semicolon between
a label and a declaration.
* gettext-tools/src/write-po.c (wrap): Likewise.
* gettext-tools/src/format-go.c (format_parse): Likewise.
Bruno Haible [Fri, 24 Oct 2025 12:13:44 +0000 (14:13 +0200)]
build: Add scripts for fetching the PO files.
* gettext-runtime/po/fetch-po: New file.
* gettext-tools/po/fetch-po: New file.
* gettext-tools/examples/po/fetch-po: New file.
* check-copyright-headers (func_check_file): Don't complain about the LINGUAS
files, that will now have more than 10 lines.
Bruno Haible [Fri, 24 Oct 2025 11:03:43 +0000 (13:03 +0200)]
po: Add customizable 'fetch-po' script.
* gettext-tools/wizard/po-templates/traditional/fetch-po: New file.
* gettext-tools/wizard/Makefile.am (po_SCRIPTS): New variable.
(EXTRA_DIST): Add the po_SCRIPTS.
* gettext-tools/wizard/gettextize.in: Copy but don't overwrite po/fetch-po.
* gettext-tools/wizard/po-templates/traditional/Makefile.in.in (fetch-po): New
target.
* gettext-tools/examples/po/Makefile.am (fetch-po): New target.
* gettext-tools/examples/hello-*/po/Makefile.am (fetch-po): New target.
* gettext-tools/examples/hello-objc-gnustep/po/GNUmakefile (fetch-po): New
target.
* gettext-tools/doc/gettext.texi (po/fetch-po): New subsection.
(po/LINGUAS): Explain how it related to the 'fetch-po' script.
(Release Management): Document how to fetch the PO files before a release.
* NEWS: Mention the change.
Bruno Haible [Sat, 18 Oct 2025 16:53:20 +0000 (18:53 +0200)]
New directory gettext-tools/wizard/po-templates/traditional/.
* gettext-tools/wizard/po-templates/traditional/*: New files, moved here from
gettext-runtime/po/.
* gettext-tools/wizard/po-templates/traditional/Makefile.in.in (install-data,
installdirs-data, uninstall-data, dist2): Remove special code for the
'gettext-tools' package.
* gettext-tools/wizard/po-templates/traditional/Makevars.template: Moved here
from gettext-tools/po/.
* autogen.sh: Copy the contents of the gettext-runtime/po/ and gettext-tools/po/
directories from gettext-tools/wizard/po-templates/traditional/.
* gettext-tools/wizard/Makefile.am (pkgdatadir, podir): New variables.
(po_DATA): Add po-templates/traditional/*.
(EXTRA_DIST): Likewise.
(uninstall-sources): Also remove $(podir)/Makevars.
* Makefile.am (distcheck-hook): Update.
Bruno Haible [Sun, 12 Oct 2025 14:31:10 +0000 (16:31 +0200)]
xgettext: Rust: Recognize 'gettextrs::gettext' invocations like 'gettext'
invocations.
Reported by Schmiddiii <gnu-savannah@schmidhuberj.de>
at <https://savannah.gnu.org/bugs/?67601>.
* gettext-tools/src/x-rust.c (ts_symbol_scoped_identifier): New variable.
(extract_from_function_call): Accept a scoped_identifier as first argument.
(extract_from_node): Allow a scoped_identifier as callee.
(extract_rust): Initialize ts_symbol_scoped_identifier.
* gettext-tools/tests/xgettext-rust-1: Add another test case.
* gettext-tools/tests/xgettext-rust-6: Likewise.
* NEWS: Mention the fix.
Bruno Haible [Sun, 12 Oct 2025 02:00:26 +0000 (04:00 +0200)]
msginit: Produce a merged PO file instead of failing.
* gettext-tools/src/msginit.c: Include <omp.h>, msgl-merge.h, backupfile.h,
copy-file.h.
(catalogname): Remove variable.
(main): When the PO file already exists, create a backup file, then merge the
two files.
(usage): Say what happens if the output file already exists.
(struct header_entry_field): New type.
(fresh_fields): Renamed from fields.
(NFIELDS): Remove macro.
(FRESH_FIELDS_LAST_TRANSLATOR): Renamed from FIELD_LAST_TRANSLATOR.
(update_fields): New variable.
(UPDATE_FIELDS_LAST_TRANSLATOR): New macro.
(fill_header): Add 'fresh' parameter. Allocate field_value array on the heap.
* gettext-tools/src/Makefile.am (msginit_SOURCES): Add msgl-fsearch.c,
msgl-merge.c.
(msginit_CFLAGS, msginit_CXXFLAGS): Link with the OpenMP flags.
* gettext-tools/doc/msginit.texi: Say what happens if the output file already
exists.
* gettext-tools/doc/gettext.texi (Creating): Change title. Mention that msginit
can also be used when continuing an existing translation.
* NEWS: Mention the improvement.
Bruno Haible [Sun, 12 Oct 2025 00:12:13 +0000 (02:12 +0200)]
Refactor: Librarify the core of msgmerge.
* gettext-tools/src/msgl-merge.h: New file, based on
gettext-tools/src/msgmerge.c.
* gettext-tools/src/msgl-merge.c: New file, based on
gettext-tools/src/msgmerge.c.
* gettext-tools/src/msgmerge.c: Include msgl-merge.h. Simplify includes.
Remove definitions that are moved to msgl-merge.c.
* gettext-tools/src/FILES: Update.
* gettext-tools/src/Makefile.am (noinst_HEADERS): Add msgl-merge.h.
(msgmerge_SOURCES): Add msgl-merge.c.
* gettext-tools/po/POTFILES.in: Add src/msgl-merge.c.
Bruno Haible [Thu, 2 Oct 2025 20:50:11 +0000 (22:50 +0200)]
Restore syntax highlighting in Emacs 30 or newer.
Reported by Sab Pyrope <sab.pyrope@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gettext/2025-03/msg00017.html>
and by Julien Palard <julien@palard.fr> in
<https://lists.gnu.org/archive/html/bug-gettext/2025-10/msg00000.html>.
* gettext-tools/emacs/HACKING: Document how to bisect Emacs regressions.
* gettext-tools/emacs/po-mode.el (po-mode-version-string): Bump to 2.31.
(po-mode): Invoke run-mode-hooks instead of run-hooks.
* NEWS: Mention the fix.
Bruno Haible [Tue, 30 Sep 2025 22:04:45 +0000 (00:04 +0200)]
xgettext: Java: Remove unjustified warning "'}' found where ')' was expected".
Reported by Alexander Hubmann-Haidvogel <ahubmann@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gettext/2025-09/msg00000.html>
and by Bjoern Voigt <bjoernv@arcor.de> in
<https://lists.gnu.org/archive/html/bug-gettext/2025-09/msg00023.html>.
* gettext-tools/src/x-java.c (extract_parenthesized): When a semicolon is seen
inside braces, start a new argparser instead of returning.
* gettext-tools/tests/xgettext-java-1: Add test cases with inner classes.
Bruno Haible [Tue, 30 Sep 2025 13:35:06 +0000 (15:35 +0200)]
libgettextpo: Add API for the workflow flags and the sticky flags.
Reported by Alexander Potashev <aspotashev@gmail.com>
at <https://savannah.gnu.org/bugs/?67470>.
* gettext-tools/src/message.h (format_flag, not_format_p): New declarations.
* gettext-tools/src/message.c (format_flag): New variable.
(not_format_p): New function.
* gettext-tools/src/write-po.c (make_format_description_string): Add comments.
(significant_format_p): Likewise.
* gettext-tools/libgettextpo/gettext-po.in.h (po_flag_iterator_t): New type.
(po_message_has_workflow_flag, po_message_set_workflow_flag,
po_message_workflow_flags_iterator): New declarations.
(po_message_has_sticky_flag, po_message_set_sticky_flag,
po_message_sticky_flags_iterator): New declarations.
(po_flag_iterator_free, po_flag_next): New declarations.
* gettext-tools/libgettextpo/gettext-po.c (struct po_flag_iterator): New type.
(po_message_has_workflow_flag, po_message_set_workflow_flag,
po_message_workflow_flags_iterator): New functions.
(po_message_get_format): Simplify by using not_format_p.
(po_message_has_sticky_flag, po_message_set_sticky_flag,
po_message_sticky_flags_iterator): New functions.
(po_flag_iterator_free, po_flag_next): New functions.
* gettext-tools/tests/gettextpo-1-prg.c (main): Add more test cases.
* gettext-tools/doc/gettext.texi (po_message_t API): Document the new functions.
(po_flag_iterator_t API): New subsection.
* NEWS: Mention the new functions.
Bruno Haible [Sat, 27 Sep 2025 11:20:39 +0000 (13:20 +0200)]
libgettextpo: New function po_message_get_format.
Reported by Alexander Potashev <aspotashev@gmail.com> in
<https://savannah.gnu.org/bugs/?67485>.
* gettext-tools/libgettextpo/gettext-po.in.h (po_message_get_format): New
declaration.
* gettext-tools/libgettextpo/gettext-po.c (po_message_get_format): New function.
* gettext-tools/tests/gettextpo-1-prg.c (main): Test the return value of
po_message_get_format. Add a test case of po_message_set_format with value -1.
* gettext-tools/doc/gettext.texi (po_message_t API): Document
po_message_get_format.
* NEWS: Mention the change.
Bruno Haible [Mon, 8 Sep 2025 14:20:17 +0000 (16:20 +0200)]
Put archive.dir.tar under version control.
This helps reducing CI failures when alpha.gnu.org is not responding.
It also simplifies the branch handling when a bug-fix release is made
on the maintenance branch of an older release.
* gettext-tools/misc/archive.dir.tar: New file.
* autopull.sh: Don't fetch it from alpha.gnu.org any more.