texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * po_document/adjust-translations.pl: new script.


From: Gavin D. Smith
Subject: branch master updated: * po_document/adjust-translations.pl: new script. * po_document: Run the script to adjust *.po files. * README-hacking: update to mention this script.
Date: Tue, 17 Oct 2023 11:21:43 -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 e3be1a6426 * po_document/adjust-translations.pl: new script. * 
po_document: Run the script to adjust *.po files. * README-hacking: update to 
mention this script.
e3be1a6426 is described below

commit e3be1a64269e262acdae296374d9b51b0588afc9
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Tue Oct 17 16:21:34 2023 +0100

    * po_document/adjust-translations.pl: new script.
    * po_document: Run the script to adjust *.po files.
    * README-hacking: update to mention this script.
---
 po_document/adjust-translations.pl | 49 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/po_document/adjust-translations.pl 
b/po_document/adjust-translations.pl
new file mode 100755
index 0000000000..c35f7b3fdb
--- /dev/null
+++ b/po_document/adjust-translations.pl
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+
+use strict;
+
+my $input_file = $ARGV[0];
+
+if (!$input_file) {
+    warn "usage: adjust_translations.pl LL.po\n";
+    exit 1;
+}
+
+my $fh;
+if (!open($fh, '<', $input_file)) {
+    warn "error opening $input_file for reading\n";
+    exit 1;
+}
+
+# Read entire contents of file.
+$/ = undef;
+my $data = <$fh>;
+if (!close ($fh)) {
+    warn "error closing $input_file\n";
+    exit 1;
+}
+
+# Strip out lines marking translations as fuzzy if a message context is
+# provided.  This is because translations contexts were added to several
+# strings, so translations will not work unless or until translation
+# files are updated at the Translation Project.
+#
+$data =~ s/#, fuzzy\n((#.*\n)*msgctxt)/$1/g;
+
+# Overwrite original file
+print $data >$input_file;
+if (!open($fh, '>', $input_file)) {
+    warn "error opening $input_file for writing\n";
+    exit 1;
+}
+
+print $fh $data;
+
+if (!close ($fh)) {
+    warn "error closing $input_file\n";
+    exit 1;
+}
+
+exit 0;
+
+



reply via email to

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