[tor-commits] r24512: {website} update po2wml to include Polish *.wmi for Polish *.wml (website/trunk)

Runa Sandvik runa.sandvik at gmail.com
Wed Mar 30 14:08:39 UTC 2011


Author: runa
Date: 2011-03-30 14:08:39 +0000 (Wed, 30 Mar 2011)
New Revision: 24512

Modified:
   website/trunk/po2wml.sh
Log:
update po2wml to include Polish *.wmi for Polish *.wml

Modified: website/trunk/po2wml.sh
===================================================================
--- website/trunk/po2wml.sh	2011-03-30 13:47:46 UTC (rev 24511)
+++ website/trunk/po2wml.sh	2011-03-30 14:08:39 UTC (rev 24512)
@@ -117,38 +117,21 @@
 				sed -i 's/PO4ASHARPEND-->//' "$wmldir/$subdir/$wmlfile"
 			fi
 
-			# If the file is an Arabic translation, include
-			# the right header, css, menu files and footer
-			if [ $subdir = "ar" ]
+			# Include the English footer for most of the
+			# translations
+			if [[ $subdir != "ar" && $subdir != "pl" ]]
 			then
-				# Head
-				orig_head=`grep '#include "head.wmi"' "$wmldir/$subdir/$wmlfile"`
-				temp_head=`echo $orig_head | sed s at head.wmi@ar/head.wmi@`
-				new_head=`echo $temp_head 'STYLESHEET="css/master-rtl.css"'`
-				sed -i "s@$orig_head@$new_head@" "$wmldir/$subdir/$wmlfile"
+				echo '#include "foot.wmi"' >> "$wmldir/$subdir/$wmlfile"
+			fi
 
-				# Side (not all files include this)
-				orig_side=`grep '#include "side.wmi"' "$wmldir/$subdir/$wmlfile"`
-				if [ -n "$orig_side" ]
-				then
-					new_side=`echo '#include "ar/side.wmi"'`
-					sed -i "s@$orig_side@$new_side@" "$wmldir/$subdir/$wmlfile"
-				fi
+			# If the directory does not include sidenav.wmi,
+			# copy it from the English directory (only if
+			# the English directory has this file)
+			if [[ ! -e "$wmldir/$subdir/sidenav.wmi" && -e "$wmldir/en/sidenav.wmi" ]]
+			then
+				cp "$wmldir/en/sidenav.wmi" "$wmldir/$subdir"
+			fi
 
-				# Info (not all files include this)
-				orig_info=`grep '#include "info.wmi"' "$wmldir/$subdir/$wmlfile"`
-				if [ -n "$orig_info" ]
-				then
-					new_info=`echo '#include "ar/info.wmi"'`
-					sed -i "s@$orig_info@$new_info@" "$wmldir/$subdir/$wmlfile"
-				fi
-
-				# Footer
-				echo '#include "ar/foot.wmi"' >> "$wmldir/$subdir/$wmlfile"
-			else
-				# Include the English footer
-				echo '#include "foot.wmi"' >> "$wmldir/$subdir/$wmlfile"
-			fi
 		fi
 	}	
 
@@ -174,38 +157,20 @@
 				sed -i "s/$translator_comment//" "$wmldir/$subdir/$lang/$wmlfile"
 			fi
 
-			# If the file is an Arabic translation, include the
-			# right header, css, menu files and footer
-			if [ $lang = "ar" ]
+			# Include the English footer for most of the
+			# translations 
+			if [[ $lang != "ar" && $lang != "pl" ]]
 			then
-				# Head
-				orig_head=`grep '#include "head.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
-				temp_head=`echo $orig_head | sed s at head.wmi@ar/head.wmi@`
-				new_head=`echo $temp_head 'STYLESHEET="css/master-rtl.css"'`
-				sed -i "s@$orig_head@$new_head@" "$wmldir/$subdir/$lang/$wmlfile"
-
-				# Side (not all files include this)
-				orig_side=`grep '#include "side.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
-				if [ -n "$orig_side" ]
-				then
-					new_side=`echo '#include "ar/side.wmi"'`
-					sed -i "s@$orig_side@$new_side@" "$wmldir/$subdir/$lang/$wmlfile"
-				fi
-
-				# Info (not all files include this)
-				orig_info=`grep '#include "info.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
-				if [ -n "$orig_info" ]
-				then
-					new_info=`echo '#include "ar/info.wmi"'`
-					sed -i "s@$orig_info@$new_info@" "$wmldir/$subdir/$lang/$wmlfile"
-				fi
-
-				# Footer
-				echo '#include "ar/foot.wmi"' >> "$wmldir/$subdir/$lang/$wmlfile"
-			else
-				# Include the English footer
 				echo '#include "foot.wmi"' >> "$wmldir/$subdir/$lang/$wmlfile"
 			fi
+
+			# If the directory does not include sidenav.wmi,
+			# copy it from the English directory (only if 
+			# the English directory has this file)
+			if [[ ! -e "$wmldir/$subdir/$lang/sidenav.wmi" && -e "$wmldir/$subdir/en/sidenav.wmi" ]]
+			then
+				cp "$wmldir/$subdir/en/sidenav.wmi" "$wmldir/$subdir/$lang/"
+			fi
 		fi
 	}
 
@@ -239,10 +204,76 @@
 		then
 			subdir="pl"
 			nosubdir
+
+			# If the file was written, include the right
+			# header, menu files and footer
+			if [ -e "$wmldir/$subdir/$wmlfile" ]
+			then
+				# Head
+				orig_head=`grep '#include "head.wmi"' "$wmldir/$subdir/$wmlfile"`
+				new_head=`echo $orig_head | sed s at head.wmi@pl/head.wmi@`
+				sed -i "s@$orig_head@$new_head@" "$wmldir/$subdir/$wmlfile"
+
+				# Side (not all files include this)
+				orig_side=`grep '#include "side.wmi"' "$wmldir/$subdir/$wmlfile"`
+				if [ -n "$orig_side" ]
+				then
+					new_side=`echo '#include "pl/side.wmi"'`
+					sed -i "s@$orig_side@$new_side@" "$wmldir/$subdir/$wmlfile"
+				fi
+
+				# Info (not all files include this)
+				orig_info=`grep '#include "info.wmi"' "$wmldir/$subdir/$wmlfile"`
+				if [ -n "$orig_info" ]
+				then
+					new_info=`echo '#include "pl/info.wmi"'`
+					sed -i "s@$orig_info@$new_info@" "$wmldir/$subdir/$wmlfile"
+				fi
+
+				# Footer
+				echo '#include "pl/foot.wmi"' >> "$wmldir/$subdir/$wmlfile"
+			fi
 		fi
 
+		# If the file is an Arabic translation, include
+		# the right header, css, menu files and footer
+                if [ $subdir = "ar" ]
+		then
+			# Convert the file first
+			nosubdir
+
+			# If it was written, do the following
+			if [ -e "$wmldir/$subdir/$wmlfile" ]
+			then
+				# Head
+				orig_head=`grep '#include "head.wmi"' "$wmldir/$subdir/$wmlfile"`
+				temp_head=`echo $orig_head | sed s at head.wmi@ar/head.wmi@`
+				new_head=`echo $temp_head 'STYLESHEET="css/master-rtl.css"'`
+				sed -i "s@$orig_head@$new_head@" "$wmldir/$subdir/$wmlfile"
+
+				# Side (not all files include this)
+				orig_side=`grep '#include "side.wmi"' "$wmldir/$subdir/$wmlfile"`
+				if [ -n "$orig_side" ]
+				then
+					new_side=`echo '#include "ar/side.wmi"'`
+					sed -i "s@$orig_side@$new_side@" "$wmldir/$subdir/$wmlfile"
+				fi
+	
+				# Info (not all files include this)
+				orig_info=`grep '#include "info.wmi"' "$wmldir/$subdir/$wmlfile"`
+				if [ -n "$orig_info" ]
+				then
+					new_info=`echo '#include "ar/info.wmi"'`
+					sed -i "s@$orig_info@$new_info@" "$wmldir/$subdir/$wmlfile"
+				fi
+
+				# Footer
+				echo '#include "ar/foot.wmi"' >> "$wmldir/$subdir/$wmlfile"
+			fi
+		fi
+
 		# Convert everything else
-		if [[ $subdir != "en" && $subdir != "zh_CN" && $subdir != "nb" && $subdir != "sv" ]]
+		if [[ $subdir != "en" && $subdir != "zh_CN" && $subdir != "nb" && $subdir != "sv" && $subdir != "ar" ]]
 		then
 			nosubdir
 		fi
@@ -273,10 +304,77 @@
 		then
 			lang="pl"
 			subdir
+
+			# If the file was written, include the right
+			# header, menu files and footer
+			if [ -e "$wmldir/$subdir/$lang/$wmlfile" ]
+			then
+				# Head
+				orig_head=`grep '#include "head.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
+				new_head=`echo $orig_head | sed s at head.wmi@pl/head.wmi@`
+				sed -i "s@$orig_head@$new_head@" "$wmldir/$subdir/$lang/$wmlfile"
+
+				# Side (not all files include this)
+				orig_side=`grep '#include "side.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
+				if [ -n "$orig_side" ]
+				then
+					new_side=`echo '#include "pl/side.wmi"'`
+					sed -i "s@$orig_side@$new_side@" "$wmldir/$subdir/$lang/$wmlfile"
+				fi
+
+				# Info (not all files include this)
+				orig_info=`grep '#include "info.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
+				if [ -n "$orig_info" ]
+				then
+					new_info=`echo '#include "pl/info.wmi"'`
+					sed -i "s@$orig_info@$new_info@" "$wmldir/$subdir/$lang/$wmlfile"
+				fi
+
+				# Footer
+				echo '#include "pl/foot.wmi"' >> "$wmldir/$subdir/$lang/$wmlfile"
+			fi
+
 		fi
 
+		# If the file is an Arabic translation, include the
+		# right header, css, menu files and footer
+		if [ $lang = "ar" ]
+		then
+			# Convert the file first
+			subdir
+
+			# If it was written, do the following
+			if [ -e "$wmldir/$subdir/$lang/$wmlfile" ]
+			then
+				# Head
+				orig_head=`grep '#include "head.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
+				temp_head=`echo $orig_head | sed s at head.wmi@ar/head.wmi@`
+				new_head=`echo $temp_head 'STYLESHEET="css/master-rtl.css"'`
+				sed -i "s@$orig_head@$new_head@" "$wmldir/$subdir/$lang/$wmlfile"
+
+				# Side (not all files include this)
+				orig_side=`grep '#include "side.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
+				if [ -n "$orig_side" ]
+				then
+					new_side=`echo '#include "ar/side.wmi"'`
+					sed -i "s@$orig_side@$new_side@" "$wmldir/$subdir/$lang/$wmlfile"
+				fi
+
+				# Info (not all files include this)
+				orig_info=`grep '#include "info.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
+				if [ -n "$orig_info" ]
+				then
+					new_info=`echo '#include "ar/info.wmi"'`
+					sed -i "s@$orig_info@$new_info@" "$wmldir/$subdir/$lang/$wmlfile"
+				fi
+
+				# Footer
+				echo '#include "ar/foot.wmi"' >> "$wmldir/$subdir/$lang/$wmlfile"
+			fi
+		fi
+
 		# Convert everything else
-		if [[ $lang != "en" && $lang != "zh_CN" && $lang != "nb" && $lang != "sv" ]]
+		if [[ $lang != "en" && $lang != "zh_CN" && $lang != "nb" && $lang != "sv" && $lang != "ar" ]]
 		then
 			subdir
 		fi



More information about the tor-commits mailing list