[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r19941: {translation} updated wml2po (translation/trunk/tools/gsoc09)
Author: runa
Date: 2009-07-07 06:29:39 -0400 (Tue, 07 Jul 2009)
New Revision: 19941
Modified:
translation/trunk/tools/gsoc09/wml2po.sh
Log:
updated wml2po
Modified: translation/trunk/tools/gsoc09/wml2po.sh
===================================================================
--- translation/trunk/tools/gsoc09/wml2po.sh 2009-07-07 03:30:29 UTC (rev 19940)
+++ translation/trunk/tools/gsoc09/wml2po.sh 2009-07-07 10:29:39 UTC (rev 19941)
@@ -10,9 +10,13 @@
### start config ###
# Location of the wml files,
-# for example "/home/runa/website/wml"
+# for example "/home/runa/tor/website"
wmldir=""
+# Location of the po files,
+# for example "/home/runa/tor/translation/projects/website"
+podir=""
+
# We need to know which languages directories we are dealing with.
# We can either read a simple text file, or look at the language
# directories in /var/lib/pootle/pootle
@@ -43,12 +47,13 @@
# Strip the file for its original extension and add .po
pofile="${wmlfile%%.*}.po"
-
- # Find out what directory the file is in
- indir=`dirname $file`
+ # Find out what directory the file is in.
+ # Also, remove the parth of the path that is $wmldir
+ indir=`dirname $file | sed "s#$wmldir/##"`
+
# The path to the directory where the po files are
- podir=`dirname $indir | sed 's/\<wml\>/po/'`
+ popath=`dirname "$podir/$indir"`
# Make sure the po file exist in every language directory
for dir in $lang ; do
@@ -56,7 +61,7 @@
# We need to know if the po file exist before we run
# po4a-updatepo. If it doesn't, po4a-updatepo will
# create it.
- if [ -e "$podir/$dir/$pofile" ]
+ if [ -e "$popath/$dir/$pofile" ]
then
poexist=1
else
@@ -67,20 +72,20 @@
# the file is updated.
if [ $poexist = 1 ]
then
- before=`grep -v '^"POT-Creation-Date:' "$podir/$dir/$pofile" | md5sum | cut -d " " -f1`
+ before=`grep -v '^"POT-Creation-Date:' "$popath/$dir/$pofile" | md5sum | cut -d " " -f1`
fi
# Update the file
- po4a-updatepo -f wml -m "$file" -p "$podir/$dir/$pofile" --master-charset utf-8
+ po4a-updatepo -f wml -m "$file" -p "$popath/$dir/$pofile" --master-charset utf-8
# Delete the backup
- rm -f "$podir/$dir/$pofile~"
+ rm -f "$popath/$dir/$pofile~"
# If the file existed before running po4a-updatepo,
# calculate the hash again.
if [ $poexist = 1 ]
then
- after=`grep -v '^"POT-Creation-Date:' "$podir/$dir/$pofile" | md5sum | cut -d " " -f1`
+ after=`grep -v '^"POT-Creation-Date:' "$popath/$dir/$pofile" | md5sum | cut -d " " -f1`
fi
# If the file did exist before running po4a-updatepo, we
@@ -91,7 +96,7 @@
then
if [ $before = $after ]
then
- svn revert "$podir/$dir/$pofile"
+ svn revert "$popath/$dir/$pofile"
fi
fi
@@ -100,14 +105,14 @@
# the repository and set the right encoding and charset.
if [ $poexist = 0 ]
then
- if [ -e "$podir/$dir/$pofile" ]
+ if [ -e "$popath/$dir/$pofile" ]
then
# Add it to the repository
- svn add "$podir/$onedirup/$dir/$pofile"
+ svn add "$popath/$dir/$pofile"
# And set the right encoding and charset
- sed -i '1,/CHARSET/ s/CHARSET/UTF-8/' "$podir/$dir/$pofile"
- sed -i '1,/ENCODING/ s/ENCODING/8bit/' "$podir/$dir/$pofile"
+ sed -i '1,/CHARSET/ s/CHARSET/UTF-8/' "$popath/$dir/$pofile"
+ sed -i '1,/ENCODING/ s/ENCODING/8bit/' "$popath/$dir/$pofile"
fi
fi
done