[or-cvs] r20134: {translation} wml2po needs to check for empty files, po2wml does not (translation/trunk/tools/gsoc09)

runa at seul.org runa at seul.org
Fri Jul 24 12:28:02 UTC 2009


Author: runa
Date: 2009-07-24 08:28:02 -0400 (Fri, 24 Jul 2009)
New Revision: 20134

Modified:
   translation/trunk/tools/gsoc09/po2wml.sh
   translation/trunk/tools/gsoc09/wml2po.sh
Log:
wml2po needs to check for empty files, po2wml does not

Modified: translation/trunk/tools/gsoc09/po2wml.sh
===================================================================
--- translation/trunk/tools/gsoc09/po2wml.sh	2009-07-24 12:10:23 UTC (rev 20133)
+++ translation/trunk/tools/gsoc09/po2wml.sh	2009-07-24 12:28:02 UTC (rev 20134)
@@ -87,15 +87,5 @@
 		# If it was written, rename it
 		mv "$wmldir/$indir/$indir-$wmlfile" "$wmldir/$indir/$wmlfile"
 
-		# 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

Modified: translation/trunk/tools/gsoc09/wml2po.sh
===================================================================
--- translation/trunk/tools/gsoc09/wml2po.sh	2009-07-24 12:10:23 UTC (rev 20133)
+++ translation/trunk/tools/gsoc09/wml2po.sh	2009-07-24 12:28:02 UTC (rev 20134)
@@ -76,7 +76,7 @@
 	for dir in $lang ; do
 		
 		# We need to know if the po file exist before we run
-		# po4a-updatepo. If it doesn't, po4a-updatepo will
+		# po4a-updatepo. If it doesn't, po4a-gettextize will
 		# create it.
 		if [ -e "$popath/$dir/$pofile" ]
 		then
@@ -96,6 +96,18 @@
 			# Check to see if the file exists
 			if [ -e "$popath/$dir/$pofile" ]
 			then
+				
+				# We don't want po files without
+				# content, so check the file first.
+				content=`cat "$popath/$dir/$pofile" | grep '^#[.]' | wc -l`
+
+				# If the po file does not have any
+				# content, delete it.
+				if [ $content = 0 ] 
+				then
+					rm -f "$popath/$dir/$pofile"
+				fi
+
 				# 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"



More information about the tor-commits mailing list