[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r20103: {translation} use gettextize for new files, updatepo for the rest (translation/trunk/tools/gsoc09)
Author: runa
Date: 2009-07-22 06:16:50 -0400 (Wed, 22 Jul 2009)
New Revision: 20103
Modified:
translation/trunk/tools/gsoc09/wml2po.sh
Log:
use gettextize for new files, updatepo for the rest
Modified: translation/trunk/tools/gsoc09/wml2po.sh
===================================================================
--- translation/trunk/tools/gsoc09/wml2po.sh 2009-07-22 09:23:50 UTC (rev 20102)
+++ translation/trunk/tools/gsoc09/wml2po.sh 2009-07-22 10:16:50 UTC (rev 20103)
@@ -70,54 +70,52 @@
else
poexist=0
fi
-
- # If the po file does exist, calculate the hash before
- # the file is updated.
- if [ $poexist = 1 ]
- then
- before=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$dir/$pofile" | md5sum | cut -d " " -f1`
- fi
- # Update the file
- po4a-updatepo -f wml -m "$file" -p "$popath/$dir/$pofile" --master-charset utf-8
-
- # Delete the backup
- rm -f "$popath/$dir/$pofile~"
-
- # If the file existed before running po4a-updatepo,
- # calculate the hash again.
- if [ $poexist = 1 ]
+ # If the po file does not exist, convert it with
+ # po4a-gettextize, set the right encoding and charset
+ # and the correct copyright.
+ if [ $poexist = 0 ]
then
- after=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$dir/$pofile" | md5sum | cut -d " " -f1`
+ # Convert it
+ po4a-gettextize -f wml -m "$file" -p "$popath/$dir/$pofile" --master-charset utf-8
+
+ # Check to see if the file exists
+ if [ -e "$popath/$dir/$pofile" ]
+ then
+ # Set the right encoding and charset
+ sed -i '1,/CHARSET/ s/CHARSET/UTF-8/' "$popath/$dir/$pofile"
+ sed -i '1,/ENCODING/ s/ENCODING/8bit/' "$popath/$dir/$pofile"
+
+ # And add it to the repository
+ svn add "$popath/$dir/$pofile"
+ fi
fi
- # If the file did exist before running po4a-updatepo, we
- # need to compare the before and after hash.
- # If they match (i.e. nothing has changed), revert the
- # file.
+ # If the po file does exist, calculate the hash first,
+ # then update the file, then calculate the hash again.
if [ $poexist = 1 ]
then
+ # Calculate the hash before we update the file
+ before=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$dir/$pofile" | md5sum | cut -d " " -f1`
+
+ # Update the po file
+ po4a-updatepo -f wml -m "$file" -p "$popath/$dir/$pofile" --master-charset utf-8
+
+ # Calculate the new hash
+ after=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$dir/$pofile" | md5sum | cut -d " " -f1`
+
+ # Delete the backup
+ rm -f "$popath/$dir/$pofile~"
+
+ # Now we need to compare the before and after
+ # hash. If they match (i.e. nothing has
+ # changed), revert the file.
if [ $before = $after ]
then
svn revert "$popath/$dir/$pofile"
fi
fi
-
- # If the file did not exist before running
- # po4a-updatepo but it does exist now, add the file to
- # the repository and set the right encoding and charset.
- if [ $poexist = 0 ]
- then
- if [ -e "$popath/$dir/$pofile" ]
- then
- # Add it to the repository
- svn add "$popath/$dir/$pofile"
- # And set the right encoding and charset
- sed -i '1,/CHARSET/ s/CHARSET/UTF-8/' "$popath/$dir/$pofile"
- sed -i '1,/ENCODING/ s/ENCODING/8bit/' "$popath/$dir/$pofile"
- fi
- fi
done
# Commit the files