[Po4a-commits] "po4a changelog, 1.241, 1.242 html-build-upload.sh, 1.14, 1.15"
Nicolas FRANCOIS
nekral-guest at alioth.debian.org
Thu Aug 16 16:46:29 UTC 2007
- Previous message: [Po4a-commits] "po4a/po/www - New directory,NONE,NONE"
- Next message: [Po4a-commits] "po4a/html .htaccess, NONE, 1.1 default.css, NONE, 1.1 documentation.php.en, NONE, 1.1 download.php.en, NONE, 1.1 features.php.en, NONE, 1.1 footer.php, NONE, 1.1 fuzzy.png, NONE, 1.1 getinvolved.php.en, NONE, 1.1 header.php.en, NONE, 1.1 header.png, NONE, 1.1 header1.php.en, NONE, 1.1 header2.php.en, NONE, 1.1 index.php.en, NONE, 1.1 po4a.conf, NONE, 1.1 table_translations_legend.php, NONE, 1.1 translated.png, NONE, 1.1 translations.php.en, NONE, 1.1 untranslated.png, NONE, 1.1"
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/po4a/po4a
In directory alioth:/tmp/cvs-serv20451
Modified Files:
changelog html-build-upload.sh
Log Message:
New website.
Index: html-build-upload.sh
===================================================================
RCS file: /cvsroot/po4a/po4a/html-build-upload.sh,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- html-build-upload.sh 8 Jul 2006 23:22:30 -0000 1.14
+++ html-build-upload.sh 16 Aug 2007 16:46:27 -0000 1.15
@@ -1,16 +1,11 @@
#! /bin/sh
+# vim: set noexpandtab tw=0:
# Rebuild the documentation and upload this to the web server.
-#
-# it does use the Marek's implementation of the pod2html converter.
-# You can find it from the CPAN, and I have a debian package of it on my
-# my web page.
-#
-# Mt.
set -e # we want to fail on any error instead of risking uploading broken stuff
#set -x
-function percent_lang {
+percent_lang() {
STATS=`msgfmt -o /dev/null --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'`
@@ -25,12 +20,11 @@
echo $((($YES*100)/$TOTAL))
}
-#function get_name {
-# cat po/pod/$1.po | sed -n -e /\"NAME\"/,+1p | sed -n -e "s/msgstr \"\(.*\)\"/\1/p"
-#}
-
-function get_charset {
+get_charset() {
case $1 in
+ en)
+ echo "UTF-8"
+ ;;
pl)
echo "ISO-8859-2"
;;
@@ -47,118 +41,249 @@
./Build man
-rm -rf html/
-cp -a blib/man html
-mkdir -p html/en/
-mv html/man* html/en/
-mkdir html/en/man3pm
+rm -rf html.gen/
+cp -a blib/man html.gen
+mkdir -p html.gen/en/
+mv html.gen/man* html.gen/en/
+mkdir html.gen/en/man3pm
+mkdir html.gen/man
+mkdir html.gen/man/man1
+mkdir html.gen/man/man3pm
+mkdir html.gen/man/man7
-# Generate the English man pages
+echo "Generate the web pages translations with po4a"
+PERLLIB=lib ./po4a -v html/po4a.conf
+
+find html.gen -name "*.pl" |
+while read f
+do
+ mv $f ${f%pl}po
+done
+
+for lang in $(grep po4a_langs html/po4a.conf | sed -e 's/\[po4a_langs\] //')
+do
+ for f in html.gen/*.${lang/pl/po}
+ do
+ sed -i -e "s/\.en\"; ?>/\.${lang/pl/po}\"; ?>/" $f
+ done
+done
+
+echo "Generate the English man pages"
find lib -name "*.pm" | while read file
do
name=$(basename $file)
name=${name//.pm/}
pod2man --section=3pm --release="Po4a Tools" --center="Po4a Tools" \
- $file html/en/man3pm/Locale::Po4a::$name.3pm
+ $file html.gen/en/man3pm/Locale::Po4a::$name.3pm
done
for file in po4a po4a-gettextize po4a-normalize po4a-translate po4a-updatepo
do
pod2man --section=1 --release="Po4a Tools" --center="Po4a Tools" \
- $file html/en/man1/$file.1
+ $file html.gen/en/man1/$file.1
done
# Main page
-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/man7/po4a.7.html\">Introduction</a>
- <a href=\"en\">Index</a>
- <br>
- <br>
- Documentation translations:
- <br>" > html/index.html
-for lang in $LANGS ; do
- PERC=`percent_lang $lang`
- echo " $lang ($PERC% translated):
- <a href=\"$lang/man7/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>" >> html/index.html
-echo " <br>
- <a href=\"http://packages.qa.debian.org/po4a\">
- Debian developer information
- </a>" >> html/index.html
-echo " <br>
- <br>
- Last update: `LANG=C date`
- </center>
- </body>
-</html>" >> html/index.html
+#for lang in $LANGS ; do
+# PERC=`percent_lang $lang`
+# echo " $lang ($PERC% translated):
+# <a href=\"$lang/man7/po4a.7.php\">Introduction</a>
+# <a href=\"$lang/\">Index</a>
+# <br>" >> html.gen/documentation_translations.php
+#done
+#echo " <br>
+# Last update: `LANG=C date`" >> html.gen/documentation_translations.php
for lang in en $LANGS ; do
echo Generate the $lang index
- [ -d html/$lang/man3 ] && mv html/$lang/man3 html/$lang/man3pm
+ if [ -d html.gen/$lang/man3 ]
+ then
+ mv html.gen/$lang/man3 html.gen/$lang/man3pm
+ fi
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<html>
<head>
- <meta content=\"text/html; charset=$(get_charset $lang)\" http-equiv=\"Content-Type\">
+ <link rel=\"stylesheet\"
+ title=\"Default Style\"
+ type=\"text/css\"
+ href=\"../default.css\" >
+ <meta content=\"text/html; charset=UTF-8\" http-equiv=\"Content-Type\">
<title>Table of Contents</title>
</head>
<body>
+ <? include \"../header1.php.${lang/pl/po}\"; ?>
+ <div id=\"content\">
<h1>Table of Contents</h1>
- <hr>
- <table>" > html/$lang/index.html
- for man in html/$lang/man*/*
+ <table>" > html.gen/man/index.php.${lang/pl/po}
+ for man in html.gen/en/man*/*
do
- title=$(lexgrog "$man" | sed -ne 's/.*: \".* - //;s/"$//;p')
- man=$(echo $man | sed -e "s/^html\/$lang\///")
+ man=$(echo $man | sed -e "s/^html.gen\/en\///")
man=${man%.gz}
man=${man/1p/1}
- ref=$man.html
+ if ls html.gen/$lang/$man* > /dev/null 2>&1
+ then
+ page=$(ls html.gen/$lang/$man*)
+ else
+ page=$(ls html.gen/en/$man*)
+ fi
+ title=$(lexgrog "$page" |
+ iconv -f $(get_charset $lang) -t utf8 | \
+ sed -ne 's/.*: \".* - //;s/"$//;p')
+ ref=$man.php
man=$(basename $man)
man=$(echo $man | sed -e 's/^\(.*\)\.\([0-9]\(pm\)\?\)$/\1(\2)/')
echo " <tr>
<td><a href=\"$ref\">$man</a></td>
<td>$title</td>
</td>
- </tr>" >> html/$lang/index.html
+ </tr>" >> html.gen/man/index.php.${lang/pl/po}
done
echo " </table>
- <hr>
+ </div>
+ <? include \"footer_index.php\"; ?>
+ <? include \"../footer.php\"; ?>
</body>
-</html>" >> html/$lang/index.html
+</html>" >> html.gen/man/index.php.${lang/pl/po}
echo Generate the $lang HTML pages
- for man in html/$lang/man*/*
+ for man in html.gen/$lang/man*/*
do
if [ "$man" != "${man%.gz}" ]
then
gunzip $man
man=${man%.gz}
fi
- out=${man/1p/1}.html
+ out=${man/1p/1}.php.${lang/pl/po}
+ out=$(echo $out | sed -e "s/html.gen\/$lang\//html.gen\/man\//")
+ footer=footer_$(basename $out)
+ footer=${footer%.${lang/pl/po}}
man2html -r $man | sed -e '/Content-type: text.html/d' \
-e '/cgi-bin.man.man2html/d' \
- -e "s/<HEAD>/<HEAD><meta content=\"text\/html; charset=$(get_charset $lang)\" http-equiv=\"Content-Type\">/" > $out
- rm -f $man
+ -e 's/\.html"/\.php"/g' \
+ -e "s/<HEAD>/<HEAD><link rel=\"stylesheet\" title=\"Default Style\" type=\"text\/css\" href=\"..\/..\/default.css\"><meta content=\"text\/html; charset=UTF-8\" http-equiv=\"Content-Type\">/" \
+ -e "s/<BODY>/<BODY><? include \"..\/..\/header2.php.${lang/pl/po}\"; ?><div id=\"content\">/" \
+ -e "s/<\/BODY>/<\/div><? include \"$footer\"; ?><? include \"..\/..\/footer.php\"; ?><\/BODY>/" | \
+ iconv -f $(get_charset $lang) -t utf8 > $out
done
+
+ if [ "$lang" != "en" ]
+ then
+ rm -rf html.gen/$lang
+ fi
done
+rm -rf html.gen/en
+gen_translations() {
+ dir="$1"
+
+ total=$(LC_ALL=C msgfmt -o /dev/null --statistics "$dir"/*.pot 2>&1 | \
+ sed -ne "s/^.* \([0-9]*\) untranslated.*$/\1/p;d")
+
+ echo "<table>"
+ for pofile in "$dir"/*.po
+ do
+ lang=${pofile%.po}
+ lang=$(basename $lang)
+ stats=$(LC_ALL=C msgfmt -o /dev/null --statistics $pofile 2>&1)
+ echo -n "<tr><td>$lang</td><td>"
+ for type in translated fuzzy untranslated
+ do
+ strings=$(echo " $stats" | \
+ sed -ne "s/^.* \([0-9]*\) $type.*$/\1/p;d")
+ if [ -n "$strings" ]
+ then
+ pcent=$((strings*100/total))
+ width=$((strings*200/total))
+ echo -n "<img height=\"10\" src=\"$type.png\" "
+ echo -n "style=\"height: 1em;\" "
+ echo -n "width=\"$width\" "
+ echo -n "alt=\"$pcent% $type ($strings/$total), \" "
+ echo -n "title=\"$type: $pcent% ($strings/$total)\"/>"
+ fi
+ done
+ echo "</td></tr>"
+ done
+ echo "<? include \"table_translations_legend.php\";?>"
+ echo "</table>"
+ echo "<p>Last update: `LC_ALL=C date`.</p>"
+}
+
+echo Generate the translation statistics for po/bin
+gen_translations po/bin > html.gen/table_translations_bin.php
+echo Generate the translation statistics for po/pod
+gen_translations po/pod > html.gen/table_translations_pod.php
+echo Generate the translation statistics for po/www
+gen_translations po/www > html.gen/table_translations_www.php
+
+echo Extract the version
+grep '$VERSION=' lib/Locale/Po4a/TransTractor.pm | \
+ sed -e 's/^.*"\([^"]*\)".*/\1/' > html.gen/version.php
+
+get_language() {
+# FIXME: use gettext
+ case $1 in
+ ca)
+ echo -n "català "
+ ;;
+ en)
+ echo -n "English"
+ ;;
+ es)
+ echo -n "español"
+ ;;
+ fr)
+ echo -n "français"
+ ;;
+ it)
+ echo -n "Italiano"
+ ;;
+ po)
+ echo -n "polski"
+ ;;
+ *)
+ echo "Language '$1' not supported" >&2
+ exit 1
+ ;;
+ esac
+}
+
+gen_language_footer() {
+ page="$1"
+# echo "Generating language footer for $page"
+ page=${page%.en}
+ page=${page#html/}
+ page=${page#html.gen/}
+ out=html.gen/$(dirname $page)/footer_$(basename $page)
+ echo "<div id=\"languages\">" > $out
+ for langcode in $(ls html/$page.* html.gen/$page.* 2>/dev/null)
+ do
+ langcode=${langcode#html/$page.}
+ langcode=${langcode#html.gen/$page.}
+ language=$(get_language $langcode)
+ echo "<a href=\"$(basename $page | sed -e 's/:/%3A/g').$langcode\">$language</a>" >> $out
+ done
+ echo "</div>" >> $out
+# echo "done"
+}
+
+echo "Generating language footers"
+for page in html/*.en
+do
+ gen_language_footer "$page"
+done
+
+find html.gen -name "*.en" |
+while read page
+do
+ gen_language_footer "$page"
+done
+
+echo Uploading...
+scp -pr html/*.* po4a.alioth.debian.org:/var/lib/gforge/chroot/home/groups/po4a/htdocs
+scp -pr html/.htaccess po4a.alioth.debian.org:/var/lib/gforge/chroot/home/groups/po4a/htdocs
+scp -pr html.gen/man po4a.alioth.debian.org:/var/lib/gforge/chroot/home/groups/po4a/htdocs
+scp -pr html.gen/*.* po4a.alioth.debian.org:/var/lib/gforge/chroot/home/groups/po4a/htdocs
+ssh po4a.alioth.debian.org chgrp -R po4a /var/lib/gforge/chroot/home/groups/po4a/htdocs
+ssh po4a.alioth.debian.org chmod -R g+rw /var/lib/gforge/chroot/home/groups/po4a/htdocs
+echo done
-scp -pr html/* po4a.alioth.debian.org:/var/lib/gforge/chroot/home/groups/po4a/htdocs/
-ssh po4a.alioth.debian.org chgrp -R po4a /var/lib/gforge/chroot/home/groups/po4a/htdocs/
-ssh po4a.alioth.debian.org chmod -R g+rw /var/lib/gforge/chroot/home/groups/po4a/htdocs/
Index: changelog
===================================================================
RCS file: /cvsroot/po4a/po4a/changelog,v
retrieving revision 1.241
retrieving revision 1.242
diff -u -d -r1.241 -r1.242
--- changelog 15 Aug 2007 20:09:01 -0000 1.241
+++ changelog 16 Aug 2007 16:46:27 -0000 1.242
@@ -1,3 +1,7 @@
+2007-08-16 Nicolas François <nicolas.francois at centraliens.net>
+
+ * html/*, po/www/*, html-build-upload.sh: New website.
+
2007-08-15 Nicolas François <nicolas.francois at centraliens.net>
* lib/Locale/Po4a/TransTractor.pm: Prepare the next 0.32 release.
- Previous message: [Po4a-commits] "po4a/po/www - New directory,NONE,NONE"
- Next message: [Po4a-commits] "po4a/html .htaccess, NONE, 1.1 default.css, NONE, 1.1 documentation.php.en, NONE, 1.1 download.php.en, NONE, 1.1 features.php.en, NONE, 1.1 footer.php, NONE, 1.1 fuzzy.png, NONE, 1.1 getinvolved.php.en, NONE, 1.1 header.php.en, NONE, 1.1 header.png, NONE, 1.1 header1.php.en, NONE, 1.1 header2.php.en, NONE, 1.1 index.php.en, NONE, 1.1 po4a.conf, NONE, 1.1 table_translations_legend.php, NONE, 1.1 translated.png, NONE, 1.1 translations.php.en, NONE, 1.1 untranslated.png, NONE, 1.1"
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Po4a-commits
mailing list