chiark / gitweb /
i18n: Copy po/Makefile and remove-potcdate.plfrom debconf
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 30 Jul 2018 06:11:29 +0000 (07:11 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 28 Sep 2018 22:29:24 +0000 (23:29 +0100)
These are from debconf.git a326240dd50487732d8546858994d48b45bf0b20.

There doesn't seem to be a common library for this kind of thing.  I'm
going to take debconf as a good example and nick the code.

Copyright: the debian/copyright file of debconf says it's
BSD-2-clause.  So add that, and copyright notices based on "git log"
(which does seem comprehensive).

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/copyright
po/Makefile [new file with mode: 0644]
po/remove-potcdate.pl [new file with mode: 0755]

index c5b10a153e14e2aafb85bf4c359b7f22f73cf353..f5c879d97cbef5f008b3db33cdd8886d8ae13435 100644 (file)
@@ -3,6 +3,9 @@ Integration between git and Debian-style archives
 
 Copyright (C)2013-2018 Ian Jackson
 Copyright (C)2016-2018 Sean Whitton
+Copyright (C)1999-2010 Joey Hess
+Copyright (C)2004-2010 Colin Watson
+
 
 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
@@ -24,6 +27,31 @@ Debian metadata, by Bill Alombert, with a licence statement saying
 it's GPL (implicitly GPLv3 compatible).
 
 
+Some of the i18n build system was copied from the Debian debconf
+package, which has the BSD-2-clause (GPLv3-compatible) licence:
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+ .
+ THIS SOFTWARE IS PROVIDED BY AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+
+
 Contributions are accepted upstram under the same terms; please sign
 off your patches (by writing an approprite Signed-Off-By tag in your
 commit message or patch submission) to indicate your attestation that
diff --git a/po/Makefile b/po/Makefile
new file mode 100644 (file)
index 0000000..e5b4bc8
--- /dev/null
@@ -0,0 +1,50 @@
+# List here all source files with translatable strings.
+POTFILES=$(sort $(shell find ../Debconf -type f -name \*.pm)) \
+       ../dpkg-* ../debconf-* ../debconf
+
+POFILES=$(wildcard *.po)
+MOFILES=$(POFILES:.po=.mo)
+
+all: debconf.pot $(MOFILES)
+
+install: all
+       for file in $(MOFILES); do \
+               lang=`echo $$file | sed 's/\.mo//'`; \
+               install -d $(prefix)/usr/share/locale/$$lang/LC_MESSAGES/; \
+               install -m 0644 $$file $(prefix)/usr/share/locale/$$lang/LC_MESSAGES/debconf.mo; \
+       done
+
+debconf.pot: $(POTFILES)
+       @echo "Rebuilding the pot file"
+       TZ=UTC xgettext $(POTFILES) -o debconf.pot.new -Lperl
+       if [ -f debconf.pot ]; then \
+               ./remove-potcdate.pl < debconf.pot > debconf.1po && \
+               ./remove-potcdate.pl < debconf.pot.new > debconf.2po && \
+               if cmp debconf.1po debconf.2po >/dev/null 2>&1; then \
+                       rm -f debconf.1po debconf.2po debconf.pot.new; \
+               else \
+                       rm -f debconf.1po debconf.2po && \
+                       mv debconf.pot.new debconf.pot; \
+               fi; \
+       else \
+               mv debconf.pot.new debconf.pot; \
+       fi
+
+clean:
+       rm -f $(MOFILES) debconf.pot.new messages messages.mo
+
+%.mo: %.po
+       msgfmt -o $@ $<
+
+%.po: debconf.pot
+       @echo -n "Merging debconf.pot and $@"
+       @msgmerge --previous $@ debconf.pot -o $@.new
+       @mv -f $@.new $@
+       @msgfmt --statistics $@
+
+check:
+       @for file in $(POFILES); do \
+               lang=`echo $$file | sed 's/\.po//'`; \
+               printf "$$lang: "; \
+               msgfmt -o /dev/null -c -v --statistics $$lang.po;\
+       done
diff --git a/po/remove-potcdate.pl b/po/remove-potcdate.pl
new file mode 100755 (executable)
index 0000000..069a1de
--- /dev/null
@@ -0,0 +1,11 @@
+#! /usr/bin/perl -n
+
+BEGIN {
+    $seen_potcdate = 0;
+}
+
+if (not $seen_potcdate and /^"POT-Creation-Date: .*"/) {
+    $seen_potcdate = 1;
+    next;
+}
+print;