]> Savannah Git Hosting - gnulib.git/commitdiff
Add infrastructure for handling gnulib localizations.
authorBruno Haible <bruno@clisp.org>
Sun, 8 Dec 2024 16:40:53 +0000 (17:40 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 8 Dec 2024 16:41:21 +0000 (17:41 +0100)
* po/Makefile: New file.
* po/Makevars: New file, based on the template from GNU gettext.
* gnulib-l10n/README: New file.
* gnulib-l10n/configure.ac: New file.
* gnulib-l10n/Makefile.am: New file.
* gnulib-l10n/m4/Makefile.am: New file.
* gnulib-l10n/autogen.sh: New file.
* gnulib-l10n/autoclean.sh: New file.
* Makefile (gnulib.pot, gnulib-tp-snapshot, gnulib-l10n-release): New
targets.

.gitignore
ChangeLog
Makefile
gnulib-l10n/Makefile.am [new file with mode: 0644]
gnulib-l10n/README [new file with mode: 0644]
gnulib-l10n/autoclean.sh [new file with mode: 0755]
gnulib-l10n/autogen.sh [new file with mode: 0755]
gnulib-l10n/configure.ac [new file with mode: 0644]
gnulib-l10n/m4/Makefile.am [new file with mode: 0644]
po/Makefile [new file with mode: 0644]
po/Makevars [new file with mode: 0644]

index b95fb408d582544e98972535f58b4411a374b5a6..fae3b941a84dd3331c86764817e224b00764acb6 100644 (file)
@@ -6,3 +6,4 @@
 allsnippets.tmp
 amsnippet.tmp
 testdir*
+/po/gnulib.pot
index daed137dfe60ceee1d74c8a3fe41a89937dd0eb1..82f7081b69ca163c47adaa226ec9b19d67e47e08 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2024-12-08  Bruno Haible  <bruno@clisp.org>
+
+       Add infrastructure for handling gnulib localizations.
+       * po/Makefile: New file.
+       * po/Makevars: New file, based on the template from GNU gettext.
+       * gnulib-l10n/README: New file.
+       * gnulib-l10n/configure.ac: New file.
+       * gnulib-l10n/Makefile.am: New file.
+       * gnulib-l10n/m4/Makefile.am: New file.
+       * gnulib-l10n/autogen.sh: New file.
+       * gnulib-l10n/autoclean.sh: New file.
+       * Makefile (gnulib.pot, gnulib-tp-snapshot, gnulib-l10n-release): New
+       targets.
+
 2024-12-08  Bruno Haible  <bruno@clisp.org>
 
        bison-i18n: Improve usability.
index 0f0b24ee96c9f05fb37ebfa51f1406c96fc9c0fa..f38619a653434260342708d35926c22bc0fac11e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -14,10 +14,16 @@ SHELL=bash
 # Produce some files that are not stored in the repository.
 all:
 
+# ==============================================================================
+# Documentation
+
 # Produce the documentation in readable form.
 info html dvi pdf:
        cd doc && $(MAKE) $@ && $(MAKE) mostlyclean
 
+# ==============================================================================
+# Various checks
+
 # Collect the names of rules starting with 'sc_'.
 syntax-check-rules := $(sort $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p'\
                        Makefile))
@@ -246,6 +252,9 @@ sc_check_GL_INLINE_HEADER_use:
 sc_check_copyright:
        @./check-copyright
 
+# ==============================================================================
+# Regenerating some files
+
 # Regenerate some files that are stored in the repository.
 regen: build-aux/bootstrap MODULES.html
 
@@ -261,6 +270,9 @@ build-aux/bootstrap: top/gen-bootstrap.sed top/bootstrap top/bootstrap-funclib.s
 MODULES.html: MODULES.html.sh
        ./MODULES.html.sh > MODULES.html
 
+# ==============================================================================
+# Updating copyright notices
+
 # A perl BEGIN block to set Y to the current year number and W to Y-1.
 _year_and_prev = BEGIN{@t=localtime(time); $$y=$$t[5]+1900; $$w=$$y-1}
 
@@ -305,3 +317,63 @@ update-copyright:
        perl -pi -e                                                     \
          '$(_year_and_prev) s/^(scriptversion=)$$w.*/$$1$$y-01-01.00/i' \
          build-aux/gendocs.sh
+
+# ==============================================================================
+# Maintaining localizations
+
+# Creates an up-to-date POT file (in the po/ directory).
+gnulib.pot:
+       cd po && make
+
+# Creates a snapshot tarball for the Translation Project. Once created,
+# 1. upload it to alpha.gnu.org via
+#    $ build-aux/gnupload --to alpha.gnu.org:gnulib gnulib-????????.tar.gz
+# 2. notify <coordinator@translationproject.org>
+gnulib-tp-snapshot: gnulib.pot
+       version=`date -u +"%Y%m%d"`; \
+       dir=gnulib-$$version; \
+       mkdir $$dir \
+       && for file in `find lib -type f` `find po -type f` COPYING; do \
+            case $$file in \
+              *.orig | *.rej | *~ | '.#'* | '#'*'#' ) ;; \
+              *) \
+                mkdir -p $$dir/`dirname $$file` || exit 1; \
+                ln $$file $$dir/$$file || exit 1; \
+            esac; \
+          done \
+       && { echo 'This tarball contains the GNU gnulib sources relevant for translators.'; \
+            echo 'It is only meant for use by the translators and the translation coordinator.'; \
+            echo 'If you are a developer, use a git checkout of the GNU gnulib project instead.'; \
+          } > $$dir/README \
+       && tar --owner=root --group=root -cf $$dir.tar $$dir \
+       && gzip -9 --force $$dir.tar \
+       && rm -rf $$dir \
+       && ls -l $$dir.tar.gz
+
+# Creates a tarball with the gnulib localizations. Once created,
+# 1. upload it to ftp.gnu.org via
+#    $ build-aux/gnupload --to ftp.gnu.org:gnulib gnulib-l10n-????????.tar.gz
+# 2. notify your preferred distros so that they pick it up.
+gnulib-l10n-release: gnulib.pot
+       cp doc/COPYING.LESSERv2 gnulib-l10n/COPYING
+       mkdir -p gnulib-l10n/po \
+       && cp po/Makevars gnulib-l10n/po/Makevars \
+       && cp po/gnulib.pot gnulib-l10n/po/gnulib.pot
+       cd gnulib-l10n \
+       && ./autogen.sh \
+       && (cd po \
+           && rm -f *.po \
+           && wget --mirror --level=1 -nd -nv -A.po https://translationproject.org/latest/gnulib/ \
+           && touch POTFILES.in \
+           && ls -1 *.po | LC_ALL=C sort | sed -e 's/\.po$$//' > LINGUAS \
+           && for file in *.po; do msgmerge --update --lang=$${file%.po} --previous $$file gnulib.pot || exit 1; done \
+           && for file in *.po; do msgfmt -c -o $${file%.po}.gmo $$file || exit 1; done \
+          ) \
+       && ./configure \
+       && make distcheck \
+       && mv gnulib-l10n-????????.tar.gz .. \
+       && make distclean \
+       && ./autoclean.sh
+       ls -l gnulib-l10n-????????.tar.gz
+
+# ==============================================================================
diff --git a/gnulib-l10n/Makefile.am b/gnulib-l10n/Makefile.am
new file mode 100644 (file)
index 0000000..3c16fc7
--- /dev/null
@@ -0,0 +1,21 @@
+## Makefile for the toplevel directory of the GNU gnulib localizations
+## Copyright (C) 2024 Free Software Foundation, Inc.
+##
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+## Process this file with automake to produce Makefile.in.
+
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = m4 po
diff --git a/gnulib-l10n/README b/gnulib-l10n/README
new file mode 100644 (file)
index 0000000..b8d0a16
--- /dev/null
@@ -0,0 +1,4 @@
+This package contains the localizations (translations) of messages for
+GNU gnulib code.
+
+It is under LGPLv2+.
diff --git a/gnulib-l10n/autoclean.sh b/gnulib-l10n/autoclean.sh
new file mode 100755 (executable)
index 0000000..87fc317
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/sh
+# GNU gnulib localizations.
+# This file is in the public domain.
+#
+# Script for cleaning all autogenerated files.
+
+test ! -f Makefile || make distclean
+rm -rf autom4te.cache
+
+# Brought in by autopoint.
+rm -f ABOUT-NLS
+rm -f config.rpath
+rm -f m4/gettext.m4
+rm -f m4/build-to-host.m4
+rm -f m4/host-cpu-c-abi.m4
+rm -f m4/iconv.m4
+rm -f m4/intlmacosx.m4
+rm -f m4/lib-ld.m4
+rm -f m4/lib-link.m4
+rm -f m4/lib-prefix.m4
+rm -f m4/nls.m4
+rm -f m4/po.m4
+rm -f m4/progtest.m4
+rm -f po/Makefile.in.in
+rm -f po/remove-potcdate.sed
+
+# Generated by aclocal.
+rm -f aclocal.m4
+
+# Generated by autoconf.
+rm -f configure
+
+# Fetched from the Translation Project.
+rm -f po/*.po
+
+# Copied from elsewhere.
+rm -f COPYING
+rm -f po/Makevars
+rm -f po/gnulib.pot
+
+# Generated or brought in by automake.
+rm -f Makefile.in
+rm -f m4/Makefile.in
+rm -f INSTALL
+rm -f compile
+rm -f install-sh
+rm -f missing
+rm -f config.guess
+rm -f config.sub
+rm -f po/POTFILES.in
+rm -f po/LINGUAS
+rm -f po/stamp-po
+rm -f po/*.gmo
diff --git a/gnulib-l10n/autogen.sh b/gnulib-l10n/autogen.sh
new file mode 100755 (executable)
index 0000000..635300b
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+# GNU gnulib localizations.
+# This file is in the public domain.
+#
+# Script for regenerating all autogenerated files.
+
+autopoint -f
+rm po/Makevars.template
+rm po/Rules-quot
+rm po/boldquot.sed
+rm po/en@boldquot.header
+rm po/en@quot.header
+rm po/insert-header.sed
+rm po/quot.sed
+
+aclocal -I m4
+autoconf
+automake --add-missing --copy
+rm -rf autom4te.cache
diff --git a/gnulib-l10n/configure.ac b/gnulib-l10n/configure.ac
new file mode 100644 (file)
index 0000000..9359aa3
--- /dev/null
@@ -0,0 +1,33 @@
+dnl Configuration for the GNU gnulib localizations
+dnl Copyright (C) 2024 Free Software Foundation, Inc.
+dnl
+dnl This program is free software: you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT([gnulib-l10n], m4_esyscmd([date -u +"%Y%m%d"]), [bug-gnulib@gnu.org])
+AC_CONFIG_SRCDIR([configure.ac])
+AM_INIT_AUTOMAKE([1.13 foreign tar-ustar])
+
+dnl Override automake's tar command used for creating distributions.
+am__tar='${AMTAR} chf - --format=ustar --owner=root --group=root "$$tardir"'
+
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION([0.23])
+
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([m4/Makefile])
+AC_CONFIG_FILES([po/Makefile.in])
+
+AC_OUTPUT
diff --git a/gnulib-l10n/m4/Makefile.am b/gnulib-l10n/m4/Makefile.am
new file mode 100644 (file)
index 0000000..2143d69
--- /dev/null
@@ -0,0 +1,22 @@
+## Makefile for the m4 directory of the GNU gnulib localizations
+## Copyright (C) 2024 Free Software Foundation, Inc.
+##
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+## Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = \
+  gettext.m4 build-to-host.m4 host-cpu-c-abi.m4 \
+  iconv.m4 intlmacosx.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 \
+  nls.m4 po.m4 progtest.m4
diff --git a/po/Makefile b/po/Makefile
new file mode 100644 (file)
index 0000000..7dfccb2
--- /dev/null
@@ -0,0 +1,18 @@
+all: gnulib.pot
+
+include Makevars
+
+VERSION != date -u +"%Y%m%d"
+
+$(DOMAIN).pot: force
+       xgettext --default-domain=$(DOMAIN) --directory=.. \
+         --add-comments=TRANSLATORS: \
+         --copyright-holder='$(COPYRIGHT_HOLDER)' \
+         --package-name='GNU gnulib' \
+         --package-version='$(VERSION)' \
+         --msgid-bugs-address='$(MSGID_BUGS_ADDRESS)' \
+         $(XGETTEXT_OPTIONS) \
+         `cd .. && LC_ALL=C grep -l '[^A-Za-z_]_(' \`find lib '(' -name '*.c' -o -name '*.h' -o -name '*.y' ')' | LC_ALL=C sort\``
+       mv $(DOMAIN).po $(DOMAIN).pot
+
+force:
diff --git a/po/Makevars b/po/Makevars
new file mode 100644 (file)
index 0000000..6383129
--- /dev/null
@@ -0,0 +1,89 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+#
+# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# This file, Makevars, is free software; the Free Software Foundation
+# gives unlimited permission to use, copy, distribute, and modify it.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = gnulib
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = \
+  --keyword=_ --flag=_:1:pass-c-format \
+  --keyword=N_ --flag=N_:1:pass-c-format \
+  --flag=error:3:c-format --flag=error_at_line:5:c-format \
+  --flag=verror:3:c-format --flag=verror_at_line:5:c-format \
+  --flag=argp_error:2:c-format --flag=argp_failure:4:c-format \
+  --flag=asprintf:2:c-format --flag=vasprintf:2:c-format --flag=xasprintf:1:c-format \
+  --flag=aszprintf:2:c-format --flag=vaszprintf:2:c-format \
+  --flag=xprintf:1:c-format --flag=xvprintf:1:c-format --flag=xfprintf:2:c-format --flag=xvfprintf:2:c-format
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
+# package.  (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.)  Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright.  The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = Free Software Foundation, Inc.
+
+# This tells whether or not to prepend "GNU " prefix to the package
+# name that gets inserted into the header of the $(DOMAIN).pot file.
+# Possible values are "yes", "no", or empty.  If it is empty, try to
+# detect it automatically by scanning the files in $(top_srcdir) for
+# "GNU packagename" string.
+PACKAGE_GNU = yes
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+#   in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+#   understood.
+# - Strings which make invalid assumptions about notation of date, time or
+#   money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS = bug-gnulib@gnu.org
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used.  It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
+
+# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
+# context.  Possible values are "yes" and "no".  Set this to yes if the
+# package uses functions taking also a message context, like pgettext(), or
+# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
+USE_MSGCTXT = no
+
+# These options get passed to msgmerge.
+# Useful options are in particular:
+#   --previous            to keep previous msgids of translated messages
+MSGMERGE_OPTIONS =
+
+# These options get passed to msginit.
+# If you want to disable line wrapping when writing PO files, add
+# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
+# MSGINIT_OPTIONS.
+MSGINIT_OPTIONS =
+
+# This tells whether or not to regenerate a PO file when $(DOMAIN).pot
+# has changed.  Possible values are "yes" and "no".  Set this to no if
+# the POT file is checked in the repository and the version control
+# program ignores timestamps.
+PO_DEPENDS_ON_POT = yes
+
+# This tells whether or not to forcibly update $(DOMAIN).pot and
+# regenerate PO files on "make dist".  Possible values are "yes" and
+# "no".  Set this to no if the POT file and PO files are maintained
+# externally.
+DIST_DEPENDS_ON_UPDATE_PO = yes