[libvirt] [PATCH] i18n: simplify mini po generation

Marty E. Plummer hanetzer at startmail.com
Sat May 18 15:56:01 UTC 2019


If you pass --for-msgfmt to msgmerge it will automatically do most of
what you had the perl script doing.

Signed-off-by: Marty E. Plummer <hanetzer at startmail.com>
---
The only downside I can see is the loss of the comment headers with the
copyright year and such. A global note in the README.md or so may be an
acceptable change.

 Makefile.am              |  1 -
 build-aux/minimize-po.pl | 37 -------------------------------------
 po/Makefile.am           |  8 +++-----
 3 files changed, 3 insertions(+), 43 deletions(-)
 delete mode 100755 build-aux/minimize-po.pl

diff --git a/Makefile.am b/Makefile.am
index dedd8d2ff8..ca7e012512 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,7 +46,6 @@ EXTRA_DIST = \
   build-aux/check-spacing.pl \
   build-aux/gitlog-to-changelog \
   build-aux/header-ifdef.pl \
-  build-aux/minimize-po.pl \
   build-aux/mock-noinline.pl \
   build-aux/prohibit-duplicate-header.pl \
   build-aux/useless-if-before-free \
diff --git a/build-aux/minimize-po.pl b/build-aux/minimize-po.pl
deleted file mode 100755
index 497533a836..0000000000
--- a/build-aux/minimize-po.pl
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/perl
-
-my @block;
-my $msgstr = 0;
-my $empty = 0;
-my $unused = 0;
-my $fuzzy = 0;
-while (<>) {
-    if (/^$/) {
-        if (!$empty && !$unused && !$fuzzy) {
-            print @block;
-        }
-        @block = ();
-        $msgstr = 0;
-        $fuzzy = 0;
-        push @block, $_;
-    } else {
-        if (/^msgstr/) {
-            $msgstr = 1;
-            $empty = 1;
-        }
-        if (/^#.*fuzzy/) {
-            $fuzzy = 1;
-        }
-        if (/^#~ msgstr/) {
-            $unused = 1;
-        }
-        if ($msgstr && /".+"/) {
-            $empty = 0;
-        }
-        push @block, $_;
-    }
-}
-
-if (@block && !$empty && !$unused) {
-    print @block;
-}
diff --git a/po/Makefile.am b/po/Makefile.am
index da117edbd5..9ac0bf3357 100644
--- a/po/Makefile.am
+++ b/po/Makefile.am
@@ -55,11 +55,9 @@ update-gmo: $(GMOFILES)
 update-mini-po: $(POTFILE)
 	for lang in $(LANGS); do \
 	  echo "Minimizing $$lang content" && \
-	  $(MSGMERGE) --no-location --no-fuzzy-matching --sort-output \
-	    $$lang.po $(POTFILE) | \
-	  $(SED) $(SED_PO_FIXUP_ARGS) | \
-	  $(PERL) $(top_srcdir)/build-aux/minimize-po.pl > \
-	    $(srcdir)/$$lang.mini.po ; \
+	  $(MSGMERGE) --for-msgfmt --sort-output \
+	    $$lang.po $(POTFILE) \
+	    -o $(srcdir)/$$lang.mini.po ; \
 	done
 
 push-pot: $(POTFILE)
-- 
2.21.0




More information about the libvir-list mailing list