texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * po/check-linguas.pl: New script to check that t


From: Gavin D. Smith
Subject: branch master updated: * po/check-linguas.pl: New script to check that the LINGUAS file matches the *.po files present in a directory. * po/Rules-checks, po_document/Rules-checks: Add a "check-linguas" target to run this script. * README-hacking: mention this as an automatic check.
Date: Thu, 19 Oct 2023 13:29:00 -0400

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 8d042ed4f9 * po/check-linguas.pl: New script to check that the LINGUAS 
file matches the *.po files present in a directory. * po/Rules-checks, 
po_document/Rules-checks: Add a "check-linguas" target to run this script. * 
README-hacking: mention this as an automatic check.
8d042ed4f9 is described below

commit 8d042ed4f9fc1a949c4544febd624a4cf0965fe0
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Thu Oct 19 18:28:53 2023 +0100

    * po/check-linguas.pl: New script to check that the LINGUAS file
    matches the *.po files present in a directory.
    * po/Rules-checks, po_document/Rules-checks: Add a "check-linguas"
    target to run this script.
    * README-hacking: mention this as an automatic check.
---
 ChangeLog                |  8 +++++++
 README-hacking           |  4 +++-
 po/Rules-checks          |  2 ++
 po/check-linguas.pl      | 54 ++++++++++++++++++++++++++++++++++++++++++++++++
 po_document/Rules-checks |  2 ++
 5 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index e452690bfd..e2ce6e3198 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-10-19  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * po/check-linguas.pl: New script to check that the LINGUAS file
+       matches the *.po files present in a directory.
+       * po/Rules-checks, po_document/Rules-checks: Add a "check-linguas"
+       target to run this script.
+       * README-hacking: mention this as an automatic check.
+
 2023-10-19  Gavin Smith <gavinsmith0123@gmail.com>
 
        * doc/texinfo.texi (Other Customization Variables)
diff --git a/README-hacking b/README-hacking
index d208e73459..b340581b05 100644
--- a/README-hacking
+++ b/README-hacking
@@ -384,8 +384,10 @@ Update translations:
                  po_document # note the trailing slashes in these commands
   git status -u to check for new translations
 
+run "make -C po check-linguas" and "make -C po_document check-linguas"
+to check that LINGUAS under po and po_document match actual file list.
+
 Ensure TXI_XLATE in doc/Makefile.am matches actual file list.
-Check that LINGUAS under po and po_document match actual file list.
 
 make
 make update-po            # both po and po_document needed, build a dist first
diff --git a/po/Rules-checks b/po/Rules-checks
new file mode 100644
index 0000000000..cf0bf0ef30
--- /dev/null
+++ b/po/Rules-checks
@@ -0,0 +1,2 @@
+check-linguas:
+       perl check-linguas.pl $(srcdir)
diff --git a/po/check-linguas.pl b/po/check-linguas.pl
new file mode 100755
index 0000000000..89cd70f5a2
--- /dev/null
+++ b/po/check-linguas.pl
@@ -0,0 +1,54 @@
+#!/usr/bin/perl
+
+# Script to check that the LINGUAS file matches the *.po files
+# present in a directory.
+
+use strict;
+use warnings;
+
+my $filename = 'LINGUAS';
+
+my $dir = $ARGV[0];
+if (!$dir) {
+    warn "usage: check-linguas.pl DIRECTORY\n";
+    exit 1;
+}
+
+if (!chdir($dir)) {
+    warn "could not chdir to $dir\n";
+    exit 1;
+}
+
+my $fh;
+if (!open($fh, '<', $filename)) {
+    warn "could not open $filename\n";
+    exit 1;
+}
+
+my @linguas;
+while (<$fh>) {
+    s/#.*$//;
+    chomp;
+    my @langs = split (' ', $_);
+    @linguas = (@linguas, @langs);
+}
+close ($fh);
+
+my @po_files;
+@po_files = glob "*.po";
+map { s/.po$// } @po_files;
+
+@linguas = sort @linguas;
+@po_files = sort @po_files;
+
+my $linguas_str = join(',', @linguas);
+my $po_files_str = join(',', @po_files);
+if ($linguas_str ne $po_files_str) {
+    print "LINGUAS does not match existing *.po files\n";
+    print "LINGUAS languages: $linguas_str\n";
+    print "po file languages: $po_files_str\n";
+    exit 1;
+}
+
+print "success: LINGUAS and *.po match\n";
+exit 0;
diff --git a/po_document/Rules-checks b/po_document/Rules-checks
new file mode 100644
index 0000000000..12d895b5ac
--- /dev/null
+++ b/po_document/Rules-checks
@@ -0,0 +1,2 @@
+check-linguas:
+       perl $(srcdir)/../po/check-linguas.pl $(srcdir)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]