libgweather r542 - trunk/po-locations



Author: danw
Date: Sat Dec  6 18:52:43 2008
New Revision: 542
URL: http://svn.gnome.org/viewvc/libgweather?rev=542&view=rev

Log:
	* Makefile.am:
	* regen.sh: move the po-sorting Makefile rule into a script so
	that translators can use it without needing to run
	autogen.sh (#563455, Claude Paroz) and so that the po files don't
	all get rebuilt by "make dist" (#562932, Vincent).

	* README.translators: update instructions


Added:
   trunk/po-locations/regen.sh   (contents, props changed)
Modified:
   trunk/po-locations/ChangeLog
   trunk/po-locations/Makefile.am
   trunk/po-locations/README.translators

Modified: trunk/po-locations/Makefile.am
==============================================================================
--- trunk/po-locations/Makefile.am	(original)
+++ trunk/po-locations/Makefile.am	Sat Dec  6 18:52:43 2008
@@ -1,18 +1,10 @@
-EXTRA_DIST = ChangeLog \
-	$(wildcard *.po) \
+EXTRA_DIST =			\
+	ChangeLog		\
+	$(wildcard *.po)	\
+	README.translators	\
+	regen.sh		\
 	extract.xsl
 
 CLEANFILES = locations.pot Locations.xml.in.h
 
 DISTCLEANFILES = .intltool-merge-cache
-
-Locations.xml.in.h: $(top_srcdir)/data/Locations.xml.in extract.xsl
-	xsltproc extract.xsl $(top_srcdir)/data/Locations.xml.in > $@
-
-locations.pot: Locations.xml.in.h
-	$(XGETTEXT) --add-comments --output=$@ --from-code=utf-8 --keyword=N_ --keyword=NC_:1c,2 --no-location $^
-
-%.po: locations.pot FORCE
-	$(MSGMERGE) -U $@ locations.pot
-
-FORCE:

Modified: trunk/po-locations/README.translators
==============================================================================
--- trunk/po-locations/README.translators	(original)
+++ trunk/po-locations/README.translators	Sat Dec  6 18:52:43 2008
@@ -1,9 +1,9 @@
 By default, intltool/gettext will generate the .po file with the
 entries sorted completely alphabetically. This is not very useful for
-po-locations, so the Makefile here has rules to generate .po files in
-a better order. Do:
+po-locations, so we've provided a script to generate .po files in a
+better order. Do:
 
-	make en_US.po
+	./regen.sh en_US.po
 
 (substituting "en_US" of course) to regenerate your .po file with the
 entries sorted as follows:

Added: trunk/po-locations/regen.sh
==============================================================================
--- (empty file)
+++ trunk/po-locations/regen.sh	Sat Dec  6 18:52:43 2008
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+if [ -z "$*" ]; then
+    echo "Usage: $0 pofile [pofile...]" 1>&2
+    exit 1
+fi
+
+# Find a file called Locations.xml.in.h which is newer than both
+# ../data/Locations.xml.in and extract.xsl, and if it's not found,
+# build it. In other words, regenerate Locations.xml.in.h if it's
+# missing or out of date.
+find . -name Locations.xml.in.h \
+       -newer ../data/Locations.xml.in \
+       -newer extract.xsl \
+       -print | grep -q . || {
+    echo "Rebuilding Locations.xml.in.h"
+    xsltproc extract.xsl ../data/Locations.xml.in > Locations.xml.in.h
+}
+
+# Likewise locations.pot
+find . -name locations.pot \
+       -newer Locations.xml.in.h \
+       -print | grep -q . || {
+    echo "Rebuilding locations.pot"
+    xgettext --add-comments --output=locations.pot --from-code=utf-8 \
+        --keyword=N_ --keyword=NC_:1c,2 --no-location Locations.xml.in.h
+}
+
+# Now rebuild po files given on command line
+status=0
+for po in "$@"; do
+    if [ -f $po ]; then
+	echo "Rebuilding $po"
+	msgmerge -U $po locations.pot
+    elif [ -f $po.po ]; then
+	echo "Rebuilding $po.po"
+	msgmerge -U $po.po locations.pot
+    else
+	echo "No such file: $po" 1>&2
+	status=1
+    fi
+done
+
+exit $status



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