[or-cvs] r23396: {website} update to current scripts from trunk. (website/branches/web20)

Andrew Lewman andrew at torproject.org
Sun Oct 3 00:58:26 UTC 2010


Author: phobos
Date: 2010-10-03 00:58:26 +0000 (Sun, 03 Oct 2010)
New Revision: 23396

Removed:
   website/branches/web20/global.js
Modified:
   website/branches/web20/Makefile
   website/branches/web20/po2wml.sh
   website/branches/web20/update-mirrors.pl
   website/branches/web20/wml2po.sh
Log:
update to current scripts from trunk.


Modified: website/branches/web20/Makefile
===================================================================
--- website/branches/web20/Makefile	2010-10-03 00:56:38 UTC (rev 23395)
+++ website/branches/web20/Makefile	2010-10-03 00:58:26 UTC (rev 23396)
@@ -19,8 +19,8 @@
 # FIXME: these are the same
 export TORSVNSTABLE=/home/phobos/onionrouter/onionrouter/tor/
 export TORGIT=/home/phobos/onionrouter/onionrouter/tor.git/.git
-export STABLETAG=tor-0.2.2.16-alpha
-export DEVTAG=tor-0.2.2.16-alpha
+export STABLETAG=tor-0.2.2.17-alpha
+export DEVTAG=tor-0.2.2.17-alpha
 
 WMLBASE=.
 SUBDIRS=docs eff projects press about download download getinvolved donate

Deleted: website/branches/web20/global.js
===================================================================
(Binary files differ)

Modified: website/branches/web20/po2wml.sh
===================================================================
--- website/branches/web20/po2wml.sh	2010-10-03 00:56:38 UTC (rev 23395)
+++ website/branches/web20/po2wml.sh	2010-10-03 00:58:26 UTC (rev 23396)
@@ -19,7 +19,7 @@
 wmldir="$PWD"
 
 # Location of the po files,
-podir="`dirname $wmldir`/translation/projects/website"
+podir="`dirname $wmldir`/translation/projects/website/po"
 
 # A lot of the wml files have custom tags. These tags have been defined
 # in website/include/versions.wmi. Tags that people usually forget to close,
@@ -96,35 +96,39 @@
 		# The location of the english wml file
 		english="$wmldir/en/$wmlfile"
 
-		# Convert the files
-		po4a-translate -f wml -m "$english" -p "$file" -l "$wmldir/$subdir/tmp-$wmlfile" --master-charset utf-8 -L utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
+		# Convert the translated file. Note that po4a will write the file and then delete it if less than 80% has been translated
+		po4a-translate -f wml -m "$english" -p "$file" -l "$wmldir/$subdir/$wmlfile" --master-charset utf-8 -L utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
 
 		# Check to see if the file was written
-                if [ -e "$wmldir/$subdir/tmp-$wmlfile" ]
+                if [ -e "$wmldir/$subdir/$wmlfile" ]
 		then
-			mv "$wmldir/$subdir/tmp-$wmlfile" "$wmldir/$subdir/$wmlfile"
-
                         # Remove last three lines in file
 			sed -i -e :a -e '$d;N;2,3ba' -e 'P;D' "$wmldir/$subdir/$wmlfile"
 
 			# Include foot.wmi
 			echo "#include <foot.wmi>" >> "$wmldir/$subdir/$wmlfile"
+
+			# If the file is mirrors.wml, include mirrors-table.wmi
+			if [ $wmlfile == "mirrors.wml" ]
+			then
+				sed -i 's/<!--PO4ASHARPBEGIN/#/' "$wmldir/$subdir/$wmlfile"
+				sed -i 's/PO4ASHARPEND-->//' "$wmldir/$subdir/$wmlfile"
+			fi
 		fi
 	}	
 
-	# Convert translations to directories such as website/torbrowser/nb/.	
+	# Convert translations to directories such as website/torbrowser/nb/.
+	# Again, po4a will write the file and then delete it if less than 80% has been translated
 	function subdir {
 		# The location of the english wml file
                 english="$wmldir/$subdir/en/$wmlfile"
 
 		# Convert the files
-		po4a-translate -f wml -m "$english" -p "$file" -l "$wmldir/$subdir/$lang/tmp-$wmlfile" --master-charset utf-8 -L utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
+		po4a-translate -f wml -m "$english" -p "$file" -l "$wmldir/$subdir/$lang/$wmlfile" --master-charset utf-8 -L utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
 
 		# Check to see if the file was written
-		if [ -e "$wmldir/$subdir/$lang/tmp-$wmlfile" ]
+		if [ -e "$wmldir/$subdir/$lang/$wmlfile" ]
 		then
-			mv "$wmldir/$subdir/$lang/tmp-$wmlfile" "$wmldir/$subdir/$lang/$wmlfile"
-
 			# Remove last three lines in file
 			sed -i -e :a -e '$d;N;2,3ba' -e 'P;D' "$wmldir/$subdir/$lang/$wmlfile"
 

Modified: website/branches/web20/update-mirrors.pl
===================================================================
--- website/branches/web20/update-mirrors.pl	2010-10-03 00:56:38 UTC (rev 23395)
+++ website/branches/web20/update-mirrors.pl	2010-10-03 00:58:26 UTC (rev 23396)
@@ -569,6 +569,25 @@
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
+        },
+
+        mirror028 => {
+            adminContact => "gouki",
+            orgName => "5ª Coluna",
+            isoCC => "PT",
+            subRegion => "",
+            region => "PT",
+            ipv4 => "True",
+            ipv6 => "False",
+            loadBalanced => "No",
+            httpWebsiteMirror => "http://tor-www.5coluna.com",
+            httpsWebsiteMirror => "https://tor-www.5coluna.com",
+            rsyncWebsiteMirror => "",
+            ftpWebsiteMirror => "",
+            httpDistMirror => "http://tor-www.5coluna.com/dist/",
+            httpsDistMirror => "https://tor-www.5coluna.com/dist/",
+            rsyncDistMirror => "",
+            hiddenServiceMirror => "",
         }
 );
 

Modified: website/branches/web20/wml2po.sh
===================================================================
--- website/branches/web20/wml2po.sh	2010-10-03 00:56:38 UTC (rev 23395)
+++ website/branches/web20/wml2po.sh	2010-10-03 00:58:26 UTC (rev 23396)
@@ -6,9 +6,10 @@
 # This is Free Software (GPLv3)
 # http://www.gnu.org/licenses/gpl-3.0.txt
 #
-# This script will convert all of the english wml files to po files, and
+# This script will convert all of the English wml files in
+# https://svn.torproject.org/svn/website/trunk/ to pot files, and
 # keep them updated. The script will also convert subdirectories that
-# exist in the english website module.
+# exist in the website module.
 #
 # For more information, see the HOWTO and README in
 # translation/tools/gsoc09.
@@ -19,19 +20,19 @@
 # Location of the wml files
 wmldir="$PWD"
 
-# Location of the po files.
+# Location of the pot files.
 # Assuming that the translation directory is relative to the website
-podir="`dirname $wmldir`/translation/projects/website"
+podir="`dirname $wmldir`/translation/projects/website/po/templates"
 
-# Set the copyright holder of the po files,
+# Set the copyright holder of the files,
 # for example "The Tor Project, Inc"
 copyright="The Tor Project, Inc"
 
 # A lot of the wml files have custom tags. These tags have been defined
 # in website/include/versions.wmi. Tags that people usually forget to close,
-# as well as tags that are not defined in versions.wmi have been added.
+# as well as tags that are not defined in versions.wmi, have been added.
 # See: https://svn.torproject.org/svn/website/trunk/include/versions.wmi
-customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <svnprojects> <input> <hr> <br> <img> <gitblob> <version-android-components> <package-androidbundle-alpha> <package-androidbundle-alpha-sig>"`
+customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <svnprojects> <input> <hr> <br> <img> <gitblob> <version-android-components> <package-androidbundle-alpha> <package-androidbundle-alpha-sig> <version-androidbundle-tor> <video controls>"`
 
 # We also need to use the nodefault option of po4a; space separated list
 # of tags that the module should not try to set by default in any
@@ -76,185 +77,175 @@
 # Create the temp log
 touch $tmplog
 
-# We need to find out which language directories we have.
-# We also need to excluse the website module directory itself, as well
-# as .svn
-langdir=`find "$podir" -maxdepth 1 -type d ! -path "$podir" ! -path "$podir/templates" ! -path "*\.*" | sed "s#$podir/##"`
-
-# We only need the english wml files, but we do not wish to translate
+# We only need the English wml files, but we do not wish to translate
 # the eff documents.
 wml=`find $wmldir -regex '^'$wmldir'/.*en/.*\.wml' -type f | grep -v '^'$wmldir'/eff'`
 
-# For every language directory, create and/or update the po files.
-for lang in $langdir ; do
+# For every English wml, see if the pot needs to be created or updated
+for file in $wml ; do
 
-	# For every english wml, see if the po needs to be created or
-	# updated
-	for file in $wml ; do
+	# Get the basename of the file we are dealing with
+	wmlfile=`basename $file`
 
-		# Get the basename of the file we are dealing with
-		wmlfile=`basename $file`
+	# Get the translation priority
+	priority=`cat $file | grep "# Translation-Priority" | awk '{print $3}'`
 
-		# Get the translation priority
-		priority=`cat $file | grep "# Translation-Priority" | awk '{print $3}'`
+	# If the file doesn't have a translation-priority, we can assume
+	# that it doesn't need to be translated. Skip this file and
+	# continue on with the next.
+	if [ ! $priority ]
+	then
+		continue
+	fi
 
-		# If the file doesn't have a translation-priority, we can assume
-		# that it doesn't need to be translated. Skip this file and
-		# continue on with the next.
-		if [ ! $priority ]
-		then
-			continue
-		fi
+	# Strip the file for its original extension and add .pot
+	pofile="$priority.${wmlfile%%.*}.pot"
 
-		# Strip the file for its original extension and add .po
-		pofile="$priority.${wmlfile%%.*}.po"
-
-		# Find out what directory the file is in.
-		# Also, remove the parth of the path that is $wmldir
-		indir=`dirname $file`
+	# Find out what directory the file is in.
+	# Also, remove the part of the path that is $wmldir
+	indir=`dirname $file`
 	
-		# We need to know what one dir up is
-		onedirup=`dirname $indir | sed "s#$wmldir/##"`
+	# We need to know what one dir up is
+	onedirup=`dirname $indir | sed "s#$wmldir/##"`
 
-		# We need to have the correct, full path to the po
-		# directory for the file we are working on.
-		# Also, did the subdirectory exist prior to running this
-		# script? If not, create it now and add it to the
-		# repository.
-		if [ $onedirup = $wmldir ]
-		then
-			popath="$podir/$lang"
-		else
+	# We need to have the correct, full path to the pot
+	# directory for the file we are working on.
+	# Also, did the subdirectory exist prior to running this
+	# script? If not, create it now and add it to the
+	# repository.
+	if [ $onedirup = $wmldir ]
+	then
+		popath="$podir"
+	else
 
-			# We need to know if a subdirectory, such as torbutton,
-			# exist in the translation module. If it does not exist,
-			# the script will create it in all the directories under
-			# translation/projects/website (excluding .svn)
-			subdir=`find "$podir/$lang" -maxdepth 1 -type d	! -path "$ppodir/$lang" ! -path "*\.*"`
+		# We need to know if a subdirectory, such as torbutton,
+		# exist in the translation module. If it does not exist,
+		# the script will create it in all the directories under
+		# translation/projects/website (excluding .svn)
+		subdir=`find "$podir" -maxdepth 1 -type d ! -path "$ppodir" ! -path "*\.*"`
 
-			for dir in $subdir ; do
-				if [ ! -d "$podir/$lang/$onedirup" ]
-				then
-					svn mkdir "$podir/$lang/$onedirup"
-				fi
-			done
+		for dir in $subdir ; do
+			if [ ! -d "$podir/$onedirup" ]
+			then
+				svn mkdir "$podir/$onedirup"
+			fi
+		done
 
-			# Set the path
-			popath="$podir/$lang/$onedirup"
+		# Set the path
+		popath="$podir/$onedirup"
 
-		fi
+	fi
 		
-		# Check to see if the po existed prior to running this
-		# script. If it didn't, check if there any files with the same
-		# filename, but different priority. If neither of the files
-		# exist, create with po4a-gettextize.
-		if [ -e "$popath/$pofile" ]
-		then
-			poexist=1
-		elif [ `find $popath -type f -name "*.$filename" | wc -l` -gt "0" ]
-		then
-			poexist=2
+	# Check to see if the pot existed prior to running this
+	# script. If it didn't, check if there any files with the same
+	# filename, but different priority. If neither of the files
+	# exist, create with po4a-gettextize.
+	if [ -e "$popath/$pofile" ]
+	then
+		poexist=1
+	elif [ `find $popath -type f -name "*.$filename" | wc -l` -gt "0" ]
+	then
+		poexist=2
 
-		# We need to rename the other file
-		for file in `find $popath -type f -name "*.$filename"` ; do
-			svn mv "$file" "$popath/$pofile"
-			echo "$popath/$pofile" > $tmplog
-		done
-	
-		else
-			poexist=0
-		fi
+	# We need to rename the other file
+	for file in `find $popath -type f -name "*.$filename"` ; do
+		svn mv "$file" "$popath/$pofile"
+		echo "$popath/$pofile" > $tmplog
+	done
 
-		# 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 ]
+	else
+		poexist=0
+	fi
+
+	# If the pot file does not exist, convert it with
+	# po4a-gettextize, set the right encoding and charset
+	# and the correct copyright.
+	if [ $poexist = 0 ]
+	then
+		# Convert it
+		po4a-gettextize -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
+
+		# Check to see if the file exists
+		if [ -e "$popath/$pofile" ]
 		then
-			# Convert it
-			po4a-gettextize -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
+			# We don't want files without
+			# content, so check the file first.
+			content=`cat "$popath/$pofile" | grep '^#[.]' | wc -l`
 
-			# Check to see if the file exists
-			if [ -e "$popath/$pofile" ]
+			# If the file does not have any
+			# content, delete it.
+			if [ $content = 0 ] 
 			then
-				# We don't want files without
-				# content, so check the file first.
-				content=`cat "$popath/$pofile" | grep '^#[.]' | wc -l`
-
-				# If the file does not have any
-				# content, delete it.
-				if [ $content = 0 ] 
-				then
-					rm -f "$popath/$pofile"
-					echo "$popath/$pofile" > $tmplog
-				else
-					# Set the right encoding and charset, as well
-					# as the correct copyright holder.
-					sed -i '0,/ENCODING/ s/ENCODING/8bit/' "$popath/$pofile"
-					sed -i '0,/CHARSET/ s/CHARSET/utf-8/' "$popath/$pofile"
-					sed -i "0,/Free Software Foundation, Inc/ s/Free Software Foundation, Inc/$copyright/" "$popath/$pofile"
+				rm -f "$popath/$pofile"
+				echo "$popath/$pofile" > $tmplog
+			else
+				# Set the right encoding and charset, as well
+				# as the correct copyright holder.
+				sed -i '0,/ENCODING/ s/ENCODING/8bit/' "$popath/$pofile"
+				sed -i '0,/CHARSET/ s/CHARSET/utf-8/' "$popath/$pofile"
+				sed -i "0,/Free Software Foundation, Inc/ s/Free Software Foundation, Inc/$copyright/" "$popath/$pofile"
 				
-					# And add it to the repository
-					svn add "$popath/$pofile"
-					echo "$popath/$pofile" > $tmplog
-				fi
+				# And add it to the repository
+				svn add "$popath/$pofile"
+				echo "$popath/$pofile" > $tmplog
 			fi
+		fi
 
-			# Update the file with po4a-updatepo to make the
-			# word wrapping perfect
-			po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
+		# Update the file with po4a-updatepo to make the
+		# word wrapping perfect
+		po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
 
-			# Delete the backup
-			rm -f "$popath/$pofile~"
-		fi
+		# Delete the backup
+		rm -f "$popath/$pofile~"
+	fi
 		
-		# 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/$pofile" | md5sum | cut -d " " -f1`
+	# If the pot 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/$pofile" | md5sum | cut -d " " -f1`
 
-			# Update the po file
-			po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
+		# Update the pot file
+		po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
 
-			# Calculate the new hash
-			after=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$pofile" | md5sum | cut -d " " -f1`
+		# Calculate the new hash
+		after=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$pofile" | md5sum | cut -d " " -f1`
 
-			# Delete the backup
-			rm -f "$popath/$pofile~"
+		# Delete the backup
+		rm -f "$popath/$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/$pofile"
-				echo "$popath/$pofile" > $tmplog
-			else
-				echo "$popath/$pofile" > $tmplog
-			fi
-		fi
-
-		# If a file with the same name but different priority
-		# exist, then rename the file (we have done so already)
-		# and update it with po4a-updatepo to make sure
-		# everything else is ok.
-		if [ $poexist = 2 ]
+		# 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
-			# Update the file
-			po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
+			svn revert "$popath/$pofile"
+			echo "$popath/$pofile" > $tmplog
+		else
+			echo "$popath/$pofile" > $tmplog
 		fi
+	fi
+
+	# If a file with the same name but different priority
+	# exist, then rename the file (we have done so already)
+	# and update it with po4a-updatepo to make sure
+	# everything else is ok.
+	if [ $poexist = 2 ]
+	then
+		# Update the file
+		po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
+	fi
 	
-		# Write to the logfile
-		if [ -e $logfile ]
+	# Write to the logfile
+	if [ -e $logfile ]
+	then
+		if [ `cat $tmplog | grep "$popath/$pofile" | wc -l` -eq "0" ]
 		then
-			if [ `cat $tmplog | grep "$popath/$pofile" | wc -l` -eq "0" ]
-			then
-				echo "could not process: " "$file" >> $logfile
-			fi
+			echo "could not process: " "$file" >> $logfile
 		fi
+	fi
 
-		# Delete the temp log
-		rm -f $tmplog
-	done
+	# Delete the temp log
+	rm -f $tmplog
 done



More information about the tor-commits mailing list