]> git.ipfire.org Git - thirdparty/gettext.git/commit
OCaml support: Add OCaml support in the tools.
authorBruno Haible <bruno@clisp.org>
Sun, 27 Jul 2025 22:07:10 +0000 (00:07 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 27 Jul 2025 22:09:35 +0000 (00:09 +0200)
commit66ce533273113468dad491f80ea248a37d39e72f
treece49e0c40eb7f2ea4e4c41c1c684bb7c5833fc1e
parentb4dc38d4bd41bf057c3de7ffafb32fdf359c1856
OCaml support: Add OCaml support in the tools.

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

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