[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r20102: {translation} keep the current wml if this is better (translation/trunk/tools/gsoc09)
Author: runa
Date: 2009-07-22 05:23:50 -0400 (Wed, 22 Jul 2009)
New Revision: 20102
Modified:
translation/trunk/tools/gsoc09/po2wml.sh
Log:
keep the current wml if this is better
Modified: translation/trunk/tools/gsoc09/po2wml.sh
===================================================================
--- translation/trunk/tools/gsoc09/po2wml.sh 2009-07-21 22:29:56 UTC (rev 20101)
+++ translation/trunk/tools/gsoc09/po2wml.sh 2009-07-22 09:23:50 UTC (rev 20102)
@@ -54,43 +54,39 @@
onedirup=`dirname "$wmldir/$indir"`
endir="$onedirup/en"
- # We need to know if the wml file exist before we run
- # po4a-translate. If it doesn't, po4a-translate will
- # create it.
- if [ -e "$wmldir/$indir/$wmlfile" ]
- then
- wmlexist=1
- else
- wmlexist=0
- fi
-
- # Write the translated wml file.
+ # Time to write the translated wml file.
# The translated document is written if 80% or more of the po
- # file has been translated. Use '-k 21' to set this
- # number down to 21%.
+ # file has been translated.
+ # Example: Use '-k 21' to set this number down to 21%.
+ # The nice thing with po4a-translate is that it will only write
+ # the translated document if 80% or more has been translated.
+ # But it will delete the wml if less than 80% has been
+ # translated. To avoid having our current, translated wml files
+ # deleted, we first convert the po to a temp wml. If this file
+ # was written, we'll rename it.
+
# Also, we don't want to convert english po back to english wml
if [ "$indir" != "en" ]
then
- po4a-translate -f wml -m "$endir/$wmlfile" -p "$file" -l "$wmldir/$indir/$wmlfile" --master-charset utf-8 -L utf-8
+ po4a-translate -f wml -m "$endir/$wmlfile" -p "$file" -l "$wmldir/$indir/$indir-$wmlfile" --master-charset utf-8 -L utf-8
fi
- # If the file did not exist before running
- # po4a-translate, check if it exists now.
- if [ $wmlexist = 0 ]
- then
- if [ -e "$wmldir/$indir/$wmlfile" ]
- then
- # Check if the po file actually has any
- # content.
- content=`cat "$file" | grep '^#[.]' | wc -l`
+ # Check to see if the file was written
+ if [ -e "$wmldir/$indir/$indir-$wmlfile" ]
+ then
+ # If it was written, rename it
+ mv "$wmldir/$indir/$indir-$wmlfile" "$wmldir/$indir/$wmlfile"
- # If the po file does not have any
- # content, delete it.
- if [ $content = 0 ]
- then
- rm -f "$wmldir/$indir/$wmlfile"
- fi
- fi
+ # Check if the po file actually has any
+ # content.
+ content=`cat "$file" | grep '^#[.]' | wc -l`
+
+ # If the po file does not have any
+ # content, delete the wml.
+ if [ $content = 0 ]
+ then
+ rm -f "$wmldir/$indir/$wmlfile"
+ fi
fi
done