[Po4a-devel][CVS] po4a html-build-upload.sh,1.1,1.2

Jordi Vilalta po4a-devel@lists.alioth.debian.org
Fri, 30 Jul 2004 11:11:33 +0000


Update of /cvsroot/po4a/po4a
In directory haydn:/tmp/cvs-serv10666

Modified Files:
	html-build-upload.sh 
Log Message:
Updated html building script to generate also the translated documentation
and a small main page.


Index: html-build-upload.sh
===================================================================
RCS file: /cvsroot/po4a/po4a/html-build-upload.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- html-build-upload.sh	29 Jul 2004 01:25:47 -0000	1.1
+++ html-build-upload.sh	30 Jul 2004 11:11:31 -0000	1.2
@@ -7,11 +7,58 @@
 #
 # Mt.
 
-set -e
-set -x
+#set -e
+#set -x
+
+function percent_lang {
+	STATS=`msgfmt --statistics po/pod/$1.po 2>&1`
+	YES=`echo $STATS | sed -n -e 's/^\([[:digit:]]*\).*$/\1/p'`
+	NO=`echo $STATS | sed -n -e 's/^\([[:digit:]]\+\)[^[:digit:]]\+\([[:digit:]]\+\).*$/\2/p'`
+	O3=`echo $STATS | sed -n -e 's/^\([[:digit:]]\+\)[^[:digit:]]\+\([[:digit:]]\+\)[^[:digit:]]\+\([[:digit:]]\+\).*$/\3/p'`
+	if [ $O3 ]; then
+		NO=$(($NO + $O3))
+	fi
+	TOTAL=$(($YES+$NO))
+	echo $((($YES*100)/$TOTAL))
+}
+
+POFILES=`cd po/pod; ls *.po`
+LANGS=${POFILES//.po/}
+
+FILES="doc/po4a.7.pod po4a po4a-*"
+
+PO4A_OPTS="-k 0 -v -f pod"
 
 rm -rf html/
-mkdir html/
-mpod2html -dir=html doc/po4a.7.pod po4a po4a-gettextize po4a-translate po4a-updatepo po4a-normalize lib
-(cd html ; ln -s podtoc.html index.html)
+mkdir -p html/en/
+
+mpod2html -dir=html/en -tocname index $FILES lib
+
+echo "<html><head><title>po4a</title></head><body><center><h1>po4a</h1><p>The po4a (po for anything) project goal is to ease translations (and more interestingly, the maintenance of translations) using gettext tools on areas where they were not expected like documentation.</p><br>English documentation: <a href=\"en/po4a.7.html\">Introduction</a> <a href=\"en\">Index</a><br><br>Documentation translations:<br>" > html/index.html
+
+for lang in $LANGS ; do
+	mkdir -p html/$lang html/tmp
+
+	#Translate $FILES
+	for file in $FILES ; do
+		newfile=${file##*/}
+		PERL5LIB=lib perl po4a-translate $PO4A_OPTS -p po/pod/$lang.po -m $file -l html/tmp/$newfile
+	done
+
+	mkdir -p html/tmp/lib/Locale/Po4a
+	#Translate modules
+	for file in lib/Locale/Po4a/*.pm ; do
+		newfile=${file##*/}
+		PERL5LIB=lib perl po4a-translate $PO4A_OPTS -m $file -p po/pod/$lang.po -l html/tmp/lib/Locale/Po4a/$newfile
+	done
+
+	mpod2html -dir=html/$lang -tocname index html/tmp/*
+	rm -rf html/tmp
+
+	PERC=`percent_lang $lang`
+	echo "$lang ($PERC% translated): <a href=\"$lang/po4a.7.html\">Introduction</a> <a href=\"$lang/\">Index</a><br>" >> html/index.html
+done
+
+echo "<br><a href=\"http://alioth.debian.org/projects/po4a/\">Alioth project page</a><br><br>Last update: `LANG=C date`</center></body></html>" >> html/index.html
+
 scp -r html/* po4a.alioth.debian.org:/var/lib/gforge/chroot/home/groups/po4a/htdocs/