[Fusionforge-commits] r7268 - in trunk: . gforge/debian gforge/utils tools

Roland Mas lolando at libremir.placard.fr.eu.org
Fri Mar 27 18:56:00 CET 2009


Author: lolando
Date: 2009-03-27 18:56:00 +0100 (Fri, 27 Mar 2009)
New Revision: 7268

Added:
   trunk/gforge/utils/manage-translations.sh
Modified:
   trunk/Makefile
   trunk/gforge/debian/rules
   trunk/tools/make-mo.sh
   trunk/tools/update-gettext-files.sh
Log:
Unified management of *.po/*.mo files in one single script (apart for the RPM packaging, where the *.mo files seem to be generated at install time)

Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2009-03-27 17:21:00 UTC (rev 7267)
+++ trunk/Makefile	2009-03-27 17:56:00 UTC (rev 7268)
@@ -31,7 +31,7 @@
 buildtar:
 	rm -fr /tmp/$(VERSION)
 	find gforge -type f -or -type l | grep -v '/.svn/' | grep -v '^./debian' | grep -v '^./deb-specific' | grep -v '^./rpm-specific' | grep -v '^./gforge.spec' | grep -v '^./README.setup' | grep -v '^./setup' | cpio -pdumB /tmp/$(VERSION)
-	cd /tmp/$(VERSION)/gforge; for l in eu bg ca zh_TW nl en eo fr de el he id it ja ko la nb pl pt_BR pt ru zh_CN es sv th ; do mkdir -p locales/$$l/LC_MESSAGES && msgfmt -o locales/$$l/LC_MESSAGES/gforge.mo translations/$$l.po ; done
+	cd /tmp/$(VERSION)/gforge; utils/manage-translations.sh build
 	cd /tmp/; tar jcf $(BUILDRESULT)/$(VERSION).tar.bz2 $(VERSION)
 	cd /tmp/$(VERSION); tar zxf $(ARCHIVE)/libphp-jpgraph_1.5.2.orig.tar.gz
 	cd /tmp/$(VERSION); patch -p0 < $(ARCHIVE)/jpgraph-1.5.2-php5_and_liberation_fonts.patch

Modified: trunk/gforge/debian/rules
===================================================================
--- trunk/gforge/debian/rules	2009-03-27 17:21:00 UTC (rev 7267)
+++ trunk/gforge/debian/rules	2009-03-27 17:56:00 UTC (rev 7268)
@@ -75,7 +75,7 @@
 	sh $(CURDIR)/deb-specific/manage-uufiles.sh decode
 
 	# Build gettext *.mo files
-	for l in eu bg ca zh_TW nl en eo fr de el he id it ja ko la nb pl pt_BR pt ru zh_CN es sv th ; do mkdir -p locales/$$l/LC_MESSAGES && msgfmt -o locales/$$l/LC_MESSAGES/gforge.mo translations/$$l.po ; done
+	utils/manage-translations.sh build
 
 	touch build-stamp
 

Added: trunk/gforge/utils/manage-translations.sh
===================================================================
--- trunk/gforge/utils/manage-translations.sh	                        (rev 0)
+++ trunk/gforge/utils/manage-translations.sh	2009-03-27 17:56:00 UTC (rev 7268)
@@ -0,0 +1,52 @@
+#! /bin/sh -e
+
+locales="eu bg ca zh_TW nl en eo fr de el he id it ja ko la nb pl pt_BR pt ru zh_CN es sv th"
+locales=$(echo $locales | xargs -n 1 | sort)
+
+if [ -e gforge/translations/gforge.pot ] ; then        # We're in the parent dir
+    cd gforge
+elif [ -e ../gforge/translations/gforge.pot ] ; then   # We're in tools/ or gforge/
+    cd ../gforge
+elif [ -e ../translations/gforge.pot ] ; then          # In a subdir of gforge
+    cd ..
+else
+    echo "Couldn't find translations directory..."
+    exit 1
+fi
+
+print_stats () {
+    for l in $(echo $locales | xargs -n 1 | sort) ; do
+	printf "* %5s: " $l
+	msgfmt --statistics -o /dev/null translations/$l.po
+    done
+}
+
+case $1 in
+    stats)
+	print_stats
+	;;
+    refresh)
+	rm translations/gforge.pot
+	
+	find -type f -\( -name \*.php -or -name users -or -name projects -\) \
+	    | grep -v -e {arch} -e svn-base \
+	    | grep -v ^./plugins/wiki \
+	    | LANG=C sort \
+	    | xargs xgettext -d gforge -o translations/gforge.pot -L PHP --from-code=iso-8859-1
+	    
+	for l in $locales ; do
+	    echo "Processing $l..."
+	    msgmerge -U translations/$l.po translations/gforge.pot
+	done
+	;;
+    build)
+	for l in $locales ; do
+	    mkdir -p locales/$l/LC_MESSAGES
+	    msgfmt -o locales/$l/LC_MESSAGES/gforge.mo translations/$l.po
+	done
+	;;
+    *)
+	echo "Unknown operation"
+	exit 1
+	;;
+esac


Property changes on: trunk/gforge/utils/manage-translations.sh
___________________________________________________________________
Added: svn:executable
   + *

Modified: trunk/tools/make-mo.sh
===================================================================
--- trunk/tools/make-mo.sh	2009-03-27 17:21:00 UTC (rev 7267)
+++ trunk/tools/make-mo.sh	2009-03-27 17:56:00 UTC (rev 7268)
@@ -1,9 +1,3 @@
 #! /bin/sh
 
-locales="eu bg ca zh_TW nl en eo fr de el he id it ja ko la nb pl pt_BR pt ru zh_CN es sv th"
-
-for l in $locales ; do
-    echo "Processing $l..."
-    mkdir -p locales/$l/LC_MESSAGES
-    msgfmt -o locales/$l/LC_MESSAGES/gforge.mo translations/$l.po
-done
+utils/manage-translations.sh build

Modified: trunk/tools/update-gettext-files.sh
===================================================================
--- trunk/tools/update-gettext-files.sh	2009-03-27 17:21:00 UTC (rev 7267)
+++ trunk/tools/update-gettext-files.sh	2009-03-27 17:56:00 UTC (rev 7268)
@@ -1,7 +1,5 @@
 #! /bin/sh
 
-locales="eu bg ca zh_TW nl en eo fr de el he id it ja ko la nb pl pt_BR pt ru zh_CN es sv th"
-
 if [ -e gforge/translations/gforge.pot ] ; then        # We're in the parent dir
     cd gforge
 elif [ -e ../gforge/translations/gforge.pot ] ; then   # We're in tools/ or gforge/
@@ -14,29 +12,7 @@
 fi
 
 if [ "$1" = --stats ] ; then
-    mode=stats
+    utils/manage-translations.sh stats
 else
-    mode=refresh
+    utils/manage-translations.sh refresh
 fi
-
-locales=$(echo $locales | xargs -n 1 | sort)
-
-if [ $mode = "refresh" ] ; then
-    rm translations/gforge.pot
-    
-    find -type f -\( -name \*.php -or -name users -or -name projects -\) \
-	| grep -v -e {arch} -e svn-base \
-	| grep -v ^./plugins/wiki \
-	| LANG=C sort \
-	| xargs xgettext -d gforge -o translations/gforge.pot -L PHP --from-code=iso-8859-1    
-	
-	for l in $locales ; do
-	    echo "Processing $l..."
-	    msgmerge -U translations/$l.po translations/gforge.pot
-	done
-fi
-
-for l in $(echo $locales | xargs -n 1 | sort) ; do
-    printf "* %5s: " $l
-    msgfmt --statistics -o /dev/null translations/$l.po
-done




More information about the Fusionforge-commits mailing list