Browse code

Remove unused version entries

Sebastian Hahn authored on05/02/2016 22:05:42
Showing1 changed files
... ...
@@ -32,7 +32,7 @@ copyright="The Tor Project, Inc"
32 32
 # in website/include/versions.wmi. Tags that people usually forget to close,
33 33
 # as well as tags that are not defined in versions.wmi, have been added.
34 34
 # See: https://svn.torproject.org/svn/website/trunk/include/versions.wmi
35
-customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <svnprojects> <input> <hr> <br> <img> <gitblob> <package-androidbundle-alpha> <version-androidbundle-tor> <video controls> <wiki>"`
35
+customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <svnprojects> <input> <hr> <br> <img> <gitblob> <video controls> <wiki>"`
36 36
 
37 37
 # We also need to use the nodefault option of po4a; space separated list
38 38
 # of tags that the module should not try to set by default in any
Browse code

minor fix

Runa A. Sandvik authored on05/09/2011 02:36:50
Showing1 changed files
... ...
@@ -195,6 +195,12 @@ for file in $wml ; do
195 195
 				svn add "$popath/$pofile"
196 196
 				echo "$popath/$pofile" > $tmplog
197 197
 			fi
198
+
199
+			# Remove po4a comments from download.wml
200
+			if [ $wmlfile = "download.wml" ]
201
+			then
202
+				sed -i 's/PO4ASHARPEND-->//g' "$popath/$pofile"
203
+			fi
198 204
 		fi
199 205
 
200 206
 		# Update the file with po4a-updatepo to make the
... ...
@@ -240,6 +246,12 @@ for file in $wml ; do
240 246
 			echo "$popath/$pofile" > $tmplog
241 247
 		else
242 248
 			echo "$popath/$pofile" > $tmplog
249
+
250
+			if [ $wmlfile = "download.wml" ]
251
+			then
252
+				sed -i 's/PO4ASHARPEND-->//g' "$popath/$pofile"
253
+			fi
254
+
243 255
 		fi
244 256
 	fi
245 257
 
Browse code

updated wml2po.sh to handle the js-stuff in download.wml

Runa A. Sandvik authored on05/09/2011 00:05:35
Showing1 changed files
... ...
@@ -162,8 +162,14 @@ for file in $wml ; do
162 162
 	# and the correct copyright.
163 163
 	if [ $poexist = 0 ]
164 164
 	then
165
-		# Convert it
166
-		po4a-gettextize -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
165
+		# Do something special for download.wml and its js
166
+		if [ $wmlfile = "download.wml" ] 
167
+		then
168
+			po4a-gettextize -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault" -o ontagerror="silent"
169
+		else
170
+			# Convert it
171
+			po4a-gettextize -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
172
+		fi
167 173
 
168 174
 		# Check to see if the file exists
169 175
 		if [ -e "$popath/$pofile" ]
... ...
@@ -193,7 +199,12 @@ for file in $wml ; do
193 199
 
194 200
 		# Update the file with po4a-updatepo to make the
195 201
 		# word wrapping perfect
196
-		po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
202
+		if [ $wmlfile = "download.wml" ]
203
+		then
204
+			po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault" -o ontagerror="silent"
205
+		else
206
+			po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
207
+		fi
197 208
 
198 209
 		# Delete the backup
199 210
 		rm -f "$popath/$pofile~"
... ...
@@ -207,7 +218,12 @@ for file in $wml ; do
207 218
 		before=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$pofile" | md5sum | cut -d " " -f1`
208 219
 
209 220
 		# Update the pot file
210
-		po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
221
+		if [ $wmlfile = "download.wml" ]
222
+		then
223
+			po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault" -o ontagerror="silent"
224
+		else
225
+			po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
226
+		fi
211 227
 
212 228
 		# Calculate the new hash
213 229
 		after=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$pofile" | md5sum | cut -d " " -f1`
... ...
@@ -234,7 +250,12 @@ for file in $wml ; do
234 250
 	if [ $poexist = 2 ]
235 251
 	then
236 252
 		# Update the file
237
-		po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
253
+		if [ $wmlfile = "download.wml" ]
254
+		then
255
+			po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault" -o ontagerror="silent"
256
+		else
257
+			po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
258
+		fi
238 259
 	fi
239 260
 	
240 261
 	# Write to the logfile
Browse code

minor update

Runa A. Sandvik authored on29/06/2011 21:38:10
Showing1 changed files
... ...
@@ -41,7 +41,7 @@ nodefault='<input>'
41 41
 
42 42
 # The script can write the name of unprocessed files to a log.
43 43
 # If you want to enable this option, set the logfile here.
44
-logfile="/home/runa/tor/wml2po.log"
44
+logfile=""
45 45
 
46 46
 # This is the temp logfile. Leave this line even if you don't want to
47 47
 # log. This will be deleted when the script is done.
Browse code

we have some translations for the website

Runa A. Sandvik authored on12/02/2011 13:18:18
Showing1 changed files
... ...
@@ -41,7 +41,7 @@ nodefault='<input>'
41 41
 
42 42
 # The script can write the name of unprocessed files to a log.
43 43
 # If you want to enable this option, set the logfile here.
44
-logfile=""
44
+logfile="/home/runa/tor/wml2po.log"
45 45
 
46 46
 # This is the temp logfile. Leave this line even if you don't want to
47 47
 # log. This will be deleted when the script is done.
Browse code

Fix download links for signatures on download-unix

They were broken since revision 23974 when the removal of -sig version
tags was a bit overzealous.

Sebastian Hahn authored on20/01/2011 02:43:02
Showing1 changed files
... ...
@@ -32,7 +32,7 @@ copyright="The Tor Project, Inc"
32 32
 # in website/include/versions.wmi. Tags that people usually forget to close,
33 33
 # as well as tags that are not defined in versions.wmi, have been added.
34 34
 # See: https://svn.torproject.org/svn/website/trunk/include/versions.wmi
35
-customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <svnprojects> <input> <hr> <br> <img> <gitblob> <package-androidbundle-alpha> <package-androidbundle-alpha-sig> <version-androidbundle-tor> <video controls> <wiki>"`
35
+customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <svnprojects> <input> <hr> <br> <img> <gitblob> <package-androidbundle-alpha> <version-androidbundle-tor> <video controls> <wiki>"`
36 36
 
37 37
 # We also need to use the nodefault option of po4a; space separated list
38 38
 # of tags that the module should not try to set by default in any
Browse code

update file path

Runa A. Sandvik authored on03/01/2011 15:38:23
Showing1 changed files
... ...
@@ -22,7 +22,7 @@ wmldir="$PWD"
22 22
 
23 23
 # Location of the pot files.
24 24
 # Assuming that the translation directory is relative to the website
25
-podir="`dirname $wmldir`/translation/projects/website/pot/templates"
25
+podir="`dirname $wmldir`/translation/projects/website/po/templates"
26 26
 
27 27
 # Set the copyright holder of the files,
28 28
 # for example "The Tor Project, Inc"
Browse code

cleaned up the list of custom tags

Runa A. Sandvik authored on17/10/2010 20:09:35
Showing1 changed files
... ...
@@ -32,7 +32,7 @@ copyright="The Tor Project, Inc"
32 32
 # in website/include/versions.wmi. Tags that people usually forget to close,
33 33
 # as well as tags that are not defined in versions.wmi, have been added.
34 34
 # See: https://svn.torproject.org/svn/website/trunk/include/versions.wmi
35
-customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <svnprojects> <input> <hr> <br> <img> <gitblob> <package-androidbundle-alpha> <package-androidbundle-alpha-sig> <version-androidbundle-tor> <video controls> <version-androidbundle-privoxy> <version-androidbundle-libevent> <wiki>"`
35
+customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <svnprojects> <input> <hr> <br> <img> <gitblob> <package-androidbundle-alpha> <package-androidbundle-alpha-sig> <version-androidbundle-tor> <video controls> <wiki>"`
36 36
 
37 37
 # We also need to use the nodefault option of po4a; space separated list
38 38
 # of tags that the module should not try to set by default in any
Browse code

updated with a few tags

Runa A. Sandvik authored on17/10/2010 17:33:54
Showing1 changed files
... ...
@@ -22,7 +22,7 @@ wmldir="$PWD"
22 22
 
23 23
 # Location of the pot files.
24 24
 # Assuming that the translation directory is relative to the website
25
-podir="`dirname $wmldir`/translation/projects/website/po/templates"
25
+podir="`dirname $wmldir`/translation/projects/website/pot/templates"
26 26
 
27 27
 # Set the copyright holder of the files,
28 28
 # for example "The Tor Project, Inc"
... ...
@@ -32,7 +32,7 @@ copyright="The Tor Project, Inc"
32 32
 # in website/include/versions.wmi. Tags that people usually forget to close,
33 33
 # as well as tags that are not defined in versions.wmi, have been added.
34 34
 # See: https://svn.torproject.org/svn/website/trunk/include/versions.wmi
35
-customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <svnprojects> <input> <hr> <br> <img> <gitblob> <package-androidbundle-alpha> <package-androidbundle-alpha-sig> <version-androidbundle-tor> <video controls>"`
35
+customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <svnprojects> <input> <hr> <br> <img> <gitblob> <package-androidbundle-alpha> <package-androidbundle-alpha-sig> <version-androidbundle-tor> <video controls> <version-androidbundle-privoxy> <version-androidbundle-libevent> <wiki>"`
36 36
 
37 37
 # We also need to use the nodefault option of po4a; space separated list
38 38
 # of tags that the module should not try to set by default in any
Browse code

The version-android-components tag got killed

Sebastian Hahn authored on10/10/2010 04:27:29
Showing1 changed files
... ...
@@ -32,7 +32,7 @@ copyright="The Tor Project, Inc"
32 32
 # in website/include/versions.wmi. Tags that people usually forget to close,
33 33
 # as well as tags that are not defined in versions.wmi, have been added.
34 34
 # See: https://svn.torproject.org/svn/website/trunk/include/versions.wmi
35
-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>"`
35
+customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <svnprojects> <input> <hr> <br> <img> <gitblob> <package-androidbundle-alpha> <package-androidbundle-alpha-sig> <version-androidbundle-tor> <video controls>"`
36 36
 
37 37
 # We also need to use the nodefault option of po4a; space separated list
38 38
 # of tags that the module should not try to set by default in any
Browse code

updated scripts with new path

Runa A. Sandvik authored on19/09/2010 14:11:39
Showing1 changed files
... ...
@@ -22,7 +22,7 @@ wmldir="$PWD"
22 22
 
23 23
 # Location of the pot files.
24 24
 # Assuming that the translation directory is relative to the website
25
-podir="`dirname $wmldir`/translation/projects/website/templates"
25
+podir="`dirname $wmldir`/translation/projects/website/po/templates"
26 26
 
27 27
 # Set the copyright holder of the files,
28 28
 # for example "The Tor Project, Inc"
Browse code

create pot files for just the templates directory

Runa A. Sandvik authored on15/08/2010 19:04:48
Showing1 changed files
... ...
@@ -6,9 +6,10 @@
6 6
 # This is Free Software (GPLv3)
7 7
 # http://www.gnu.org/licenses/gpl-3.0.txt
8 8
 #
9
-# This script will convert all of the english wml files to po files, and
9
+# This script will convert all of the English wml files in
10
+# https://svn.torproject.org/svn/website/trunk/ to pot files, and
10 11
 # keep them updated. The script will also convert subdirectories that
11
-# exist in the english website module.
12
+# exist in the website module.
12 13
 #
13 14
 # For more information, see the HOWTO and README in
14 15
 # translation/tools/gsoc09.
... ...
@@ -19,19 +20,19 @@
19 20
 # Location of the wml files
20 21
 wmldir="$PWD"
21 22
 
22
-# Location of the po files.
23
+# Location of the pot files.
23 24
 # Assuming that the translation directory is relative to the website
24
-podir="`dirname $wmldir`/translation/projects/website"
25
+podir="`dirname $wmldir`/translation/projects/website/templates"
25 26
 
26
-# Set the copyright holder of the po files,
27
+# Set the copyright holder of the files,
27 28
 # for example "The Tor Project, Inc"
28 29
 copyright="The Tor Project, Inc"
29 30
 
30 31
 # A lot of the wml files have custom tags. These tags have been defined
31 32
 # in website/include/versions.wmi. Tags that people usually forget to close,
32
-# as well as tags that are not defined in versions.wmi have been added.
33
+# as well as tags that are not defined in versions.wmi, have been added.
33 34
 # See: https://svn.torproject.org/svn/website/trunk/include/versions.wmi
34
-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>"`
35
+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>"`
35 36
 
36 37
 # We also need to use the nodefault option of po4a; space separated list
37 38
 # of tags that the module should not try to set by default in any
... ...
@@ -40,7 +41,7 @@ nodefault='<input>'
40 41
 
41 42
 # The script can write the name of unprocessed files to a log.
42 43
 # If you want to enable this option, set the logfile here.
43
-logfile="/home/runa/tor/wml2po.log"
44
+logfile=""
44 45
 
45 46
 # This is the temp logfile. Leave this line even if you don't want to
46 47
 # log. This will be deleted when the script is done.
... ...
@@ -76,185 +77,175 @@ fi
76 77
 # Create the temp log
77 78
 touch $tmplog
78 79
 
79
-# We need to find out which language directories we have.
80
-# We also need to excluse the website module directory itself, as well
81
-# as .svn
82
-langdir=`find "$podir" -maxdepth 1 -type d ! -path "$podir" ! -path "$podir/templates" ! -path "*\.*" | sed "s#$podir/##"`
83
-
84
-# We only need the english wml files, but we do not wish to translate
80
+# We only need the English wml files, but we do not wish to translate
85 81
 # the eff documents.
86 82
 wml=`find $wmldir -regex '^'$wmldir'/.*en/.*\.wml' -type f | grep -v '^'$wmldir'/eff'`
87 83
 
88
-# For every language directory, create and/or update the po files.
89
-for lang in $langdir ; do
90
-
91
-	# For every english wml, see if the po needs to be created or
92
-	# updated
93
-	for file in $wml ; do
94
-
95
-		# Get the basename of the file we are dealing with
96
-		wmlfile=`basename $file`
97
-
98
-		# Get the translation priority
99
-		priority=`cat $file | grep "# Translation-Priority" | awk '{print $3}'`
100
-
101
-		# If the file doesn't have a translation-priority, we can assume
102
-		# that it doesn't need to be translated. Skip this file and
103
-		# continue on with the next.
104
-		if [ ! $priority ]
105
-		then
106
-			continue
107
-		fi
108
-
109
-		# Strip the file for its original extension and add .po
110
-		pofile="$priority.${wmlfile%%.*}.po"
111
-
112
-		# Find out what directory the file is in.
113
-		# Also, remove the parth of the path that is $wmldir
114
-		indir=`dirname $file`
115
-	
116
-		# We need to know what one dir up is
117
-		onedirup=`dirname $indir | sed "s#$wmldir/##"`
118
-
119
-		# We need to have the correct, full path to the po
120
-		# directory for the file we are working on.
121
-		# Also, did the subdirectory exist prior to running this
122
-		# script? If not, create it now and add it to the
123
-		# repository.
124
-		if [ $onedirup = $wmldir ]
125
-		then
126
-			popath="$podir/$lang"
127
-		else
84
+# For every English wml, see if the pot needs to be created or updated
85
+for file in $wml ; do
128 86
 
129
-			# We need to know if a subdirectory, such as torbutton,
130
-			# exist in the translation module. If it does not exist,
131
-			# the script will create it in all the directories under
132
-			# translation/projects/website (excluding .svn)
133
-			subdir=`find "$podir/$lang" -maxdepth 1 -type d	! -path "$ppodir/$lang" ! -path "*\.*"`
87
+	# Get the basename of the file we are dealing with
88
+	wmlfile=`basename $file`
134 89
 
135
-			for dir in $subdir ; do
136
-				if [ ! -d "$podir/$lang/$onedirup" ]
137
-				then
138
-					svn mkdir "$podir/$lang/$onedirup"
139
-				fi
140
-			done
90
+	# Get the translation priority
91
+	priority=`cat $file | grep "# Translation-Priority" | awk '{print $3}'`
141 92
 
142
-			# Set the path
143
-			popath="$podir/$lang/$onedirup"
93
+	# If the file doesn't have a translation-priority, we can assume
94
+	# that it doesn't need to be translated. Skip this file and
95
+	# continue on with the next.
96
+	if [ ! $priority ]
97
+	then
98
+		continue
99
+	fi
144 100
 
145
-		fi
146
-		
147
-		# Check to see if the po existed prior to running this
148
-		# script. If it didn't, check if there any files with the same
149
-		# filename, but different priority. If neither of the files
150
-		# exist, create with po4a-gettextize.
151
-		if [ -e "$popath/$pofile" ]
152
-		then
153
-			poexist=1
154
-		elif [ `find $popath -type f -name "*.$filename" | wc -l` -gt "0" ]
155
-		then
156
-			poexist=2
101
+	# Strip the file for its original extension and add .pot
102
+	pofile="$priority.${wmlfile%%.*}.pot"
157 103
 
158
-		# We need to rename the other file
159
-		for file in `find $popath -type f -name "*.$filename"` ; do
160
-			svn mv "$file" "$popath/$pofile"
161
-			echo "$popath/$pofile" > $tmplog
162
-		done
104
+	# Find out what directory the file is in.
105
+	# Also, remove the part of the path that is $wmldir
106
+	indir=`dirname $file`
163 107
 	
164
-		else
165
-			poexist=0
166
-		fi
167
-
168
-		# If the po file does not exist, convert it with
169
-		# po4a-gettextize, set the right encoding and charset
170
-		# and the correct copyright.
171
-		if [ $poexist = 0 ]
172
-		then
173
-			# Convert it
174
-			po4a-gettextize -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
175
-
176
-			# Check to see if the file exists
177
-			if [ -e "$popath/$pofile" ]
108
+	# We need to know what one dir up is
109
+	onedirup=`dirname $indir | sed "s#$wmldir/##"`
110
+
111
+	# We need to have the correct, full path to the pot
112
+	# directory for the file we are working on.
113
+	# Also, did the subdirectory exist prior to running this
114
+	# script? If not, create it now and add it to the
115
+	# repository.
116
+	if [ $onedirup = $wmldir ]
117
+	then
118
+		popath="$podir"
119
+	else
120
+
121
+		# We need to know if a subdirectory, such as torbutton,
122
+		# exist in the translation module. If it does not exist,
123
+		# the script will create it in all the directories under
124
+		# translation/projects/website (excluding .svn)
125
+		subdir=`find "$podir" -maxdepth 1 -type d ! -path "$ppodir" ! -path "*\.*"`
126
+
127
+		for dir in $subdir ; do
128
+			if [ ! -d "$podir/$onedirup" ]
178 129
 			then
179
-				# We don't want files without
180
-				# content, so check the file first.
181
-				content=`cat "$popath/$pofile" | grep '^#[.]' | wc -l`
182
-
183
-				# If the file does not have any
184
-				# content, delete it.
185
-				if [ $content = 0 ] 
186
-				then
187
-					rm -f "$popath/$pofile"
188
-					echo "$popath/$pofile" > $tmplog
189
-				else
190
-					# Set the right encoding and charset, as well
191
-					# as the correct copyright holder.
192
-					sed -i '0,/ENCODING/ s/ENCODING/8bit/' "$popath/$pofile"
193
-					sed -i '0,/CHARSET/ s/CHARSET/utf-8/' "$popath/$pofile"
194
-					sed -i "0,/Free Software Foundation, Inc/ s/Free Software Foundation, Inc/$copyright/" "$popath/$pofile"
195
-				
196
-					# And add it to the repository
197
-					svn add "$popath/$pofile"
198
-					echo "$popath/$pofile" > $tmplog
199
-				fi
130
+				svn mkdir "$podir/$onedirup"
200 131
 			fi
132
+		done
201 133
 
202
-			# Update the file with po4a-updatepo to make the
203
-			# word wrapping perfect
204
-			po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
134
+		# Set the path
135
+		popath="$podir/$onedirup"
205 136
 
206
-			# Delete the backup
207
-			rm -f "$popath/$pofile~"
208
-		fi
137
+	fi
209 138
 		
210
-		# If the po file does exist, calculate the hash first,
211
-		# then update the file, then calculate the hash again.
212
-		if [ $poexist = 1 ]
213
-		then
214
-			# Calculate the hash before we update the file
215
-			before=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$pofile" | md5sum | cut -d " " -f1`
139
+	# Check to see if the pot existed prior to running this
140
+	# script. If it didn't, check if there any files with the same
141
+	# filename, but different priority. If neither of the files
142
+	# exist, create with po4a-gettextize.
143
+	if [ -e "$popath/$pofile" ]
144
+	then
145
+		poexist=1
146
+	elif [ `find $popath -type f -name "*.$filename" | wc -l` -gt "0" ]
147
+	then
148
+		poexist=2
149
+
150
+	# We need to rename the other file
151
+	for file in `find $popath -type f -name "*.$filename"` ; do
152
+		svn mv "$file" "$popath/$pofile"
153
+		echo "$popath/$pofile" > $tmplog
154
+	done
216 155
 
217
-			# Update the po file
218
-			po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
156
+	else
157
+		poexist=0
158
+	fi
219 159
 
220
-			# Calculate the new hash
221
-			after=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$pofile" | md5sum | cut -d " " -f1`
160
+	# If the pot file does not exist, convert it with
161
+	# po4a-gettextize, set the right encoding and charset
162
+	# and the correct copyright.
163
+	if [ $poexist = 0 ]
164
+	then
165
+		# Convert it
166
+		po4a-gettextize -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
222 167
 
223
-			# Delete the backup
224
-			rm -f "$popath/$pofile~"
168
+		# Check to see if the file exists
169
+		if [ -e "$popath/$pofile" ]
170
+		then
171
+			# We don't want files without
172
+			# content, so check the file first.
173
+			content=`cat "$popath/$pofile" | grep '^#[.]' | wc -l`
225 174
 
226
-			# Now we need to compare the before and after
227
-			# hash. If they match (i.e. nothing has
228
-			# changed), revert the file.
229
-			if [ $before = $after ]
175
+			# If the file does not have any
176
+			# content, delete it.
177
+			if [ $content = 0 ] 
230 178
 			then
231
-				svn revert "$popath/$pofile"
179
+				rm -f "$popath/$pofile"
232 180
 				echo "$popath/$pofile" > $tmplog
233 181
 			else
182
+				# Set the right encoding and charset, as well
183
+				# as the correct copyright holder.
184
+				sed -i '0,/ENCODING/ s/ENCODING/8bit/' "$popath/$pofile"
185
+				sed -i '0,/CHARSET/ s/CHARSET/utf-8/' "$popath/$pofile"
186
+				sed -i "0,/Free Software Foundation, Inc/ s/Free Software Foundation, Inc/$copyright/" "$popath/$pofile"
187
+				
188
+				# And add it to the repository
189
+				svn add "$popath/$pofile"
234 190
 				echo "$popath/$pofile" > $tmplog
235 191
 			fi
236 192
 		fi
237 193
 
238
-		# If a file with the same name but different priority
239
-		# exist, then rename the file (we have done so already)
240
-		# and update it with po4a-updatepo to make sure
241
-		# everything else is ok.
242
-		if [ $poexist = 2 ]
194
+		# Update the file with po4a-updatepo to make the
195
+		# word wrapping perfect
196
+		po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
197
+
198
+		# Delete the backup
199
+		rm -f "$popath/$pofile~"
200
+	fi
201
+		
202
+	# If the pot file does exist, calculate the hash first,
203
+	# then update the file, then calculate the hash again.
204
+	if [ $poexist = 1 ]
205
+	then
206
+		# Calculate the hash before we update the file
207
+		before=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$pofile" | md5sum | cut -d " " -f1`
208
+
209
+		# Update the pot file
210
+		po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
211
+
212
+		# Calculate the new hash
213
+		after=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$pofile" | md5sum | cut -d " " -f1`
214
+
215
+		# Delete the backup
216
+		rm -f "$popath/$pofile~"
217
+
218
+		# Now we need to compare the before and after
219
+		# hash. If they match (i.e. nothing has
220
+		# changed), revert the file.
221
+		if [ $before = $after ]
243 222
 		then
244
-			# Update the file
245
-			po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
223
+			svn revert "$popath/$pofile"
224
+			echo "$popath/$pofile" > $tmplog
225
+		else
226
+			echo "$popath/$pofile" > $tmplog
246 227
 		fi
228
+	fi
229
+
230
+	# If a file with the same name but different priority
231
+	# exist, then rename the file (we have done so already)
232
+	# and update it with po4a-updatepo to make sure
233
+	# everything else is ok.
234
+	if [ $poexist = 2 ]
235
+	then
236
+		# Update the file
237
+		po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
238
+	fi
247 239
 	
248
-		# Write to the logfile
249
-		if [ -e $logfile ]
240
+	# Write to the logfile
241
+	if [ -e $logfile ]
242
+	then
243
+		if [ `cat $tmplog | grep "$popath/$pofile" | wc -l` -eq "0" ]
250 244
 		then
251
-			if [ `cat $tmplog | grep "$popath/$pofile" | wc -l` -eq "0" ]
252
-			then
253
-				echo "could not process: " "$file" >> $logfile
254
-			fi
245
+			echo "could not process: " "$file" >> $logfile
255 246
 		fi
247
+	fi
256 248
 
257
-		# Delete the temp log
258
-		rm -f $tmplog
259
-	done
249
+	# Delete the temp log
250
+	rm -f $tmplog
260 251
 done
Browse code

updated translations for the website

Runa A. Sandvik authored on09/08/2010 22:39:40
Showing1 changed files
... ...
@@ -40,7 +40,7 @@ nodefault='<input>'
40 40
 
41 41
 # The script can write the name of unprocessed files to a log.
42 42
 # If you want to enable this option, set the logfile here.
43
-logfile=""
43
+logfile="/home/runa/tor/wml2po.log"
44 44
 
45 45
 # This is the temp logfile. Leave this line even if you don't want to
46 46
 # log. This will be deleted when the script is done.
Browse code

closed a tag in one file, added a new custom tag in another

Runa A. Sandvik authored on23/06/2010 16:03:04
Showing1 changed files
... ...
@@ -31,7 +31,7 @@ copyright="The Tor Project, Inc"
31 31
 # in website/include/versions.wmi. Tags that people usually forget to close,
32 32
 # as well as tags that are not defined in versions.wmi have been added.
33 33
 # See: https://svn.torproject.org/svn/website/trunk/include/versions.wmi
34
-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>"`
34
+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>"`
35 35
 
36 36
 # We also need to use the nodefault option of po4a; space separated list
37 37
 # of tags that the module should not try to set by default in any
Browse code

fixed an email address in verifying-signatures and added two new tags to wml2po

Runa A. Sandvik authored on27/05/2010 18:08:37
Showing1 changed files
... ...
@@ -31,7 +31,7 @@ copyright="The Tor Project, Inc"
31 31
 # in website/include/versions.wmi. Tags that people usually forget to close,
32 32
 # as well as tags that are not defined in versions.wmi have been added.
33 33
 # See: https://svn.torproject.org/svn/website/trunk/include/versions.wmi
34
-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>"`
34
+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>"`
35 35
 
36 36
 # We also need to use the nodefault option of po4a; space separated list
37 37
 # of tags that the module should not try to set by default in any
Browse code

there is no need for the path to my logfile

Runa A. Sandvik authored on17/04/2010 00:30:26
Showing1 changed files
... ...
@@ -40,7 +40,7 @@ nodefault='<input>'
40 40
 
41 41
 # The script can write the name of unprocessed files to a log.
42 42
 # If you want to enable this option, set the logfile here.
43
-logfile="/home/runa/tor/wml2po.log"
43
+logfile=""
44 44
 
45 45
 # This is the temp logfile. Leave this line even if you don't want to
46 46
 # log. This will be deleted when the script is done.
Browse code

updated translations for the website

Runa A. Sandvik authored on13/04/2010 09:17:22
Showing1 changed files
... ...
@@ -40,7 +40,7 @@ nodefault='<input>'
40 40
 
41 41
 # The script can write the name of unprocessed files to a log.
42 42
 # If you want to enable this option, set the logfile here.
43
-logfile=""
43
+logfile="/home/runa/tor/wml2po.log"
44 44
 
45 45
 # This is the temp logfile. Leave this line even if you don't want to
46 46
 # log. This will be deleted when the script is done.
Browse code

Add a link tag for svnprojects, pointing to https://svn.torproject.org/svn/projects/

Steven Murdoch authored on25/03/2010 16:02:01
Showing1 changed files
... ...
@@ -31,7 +31,7 @@ copyright="The Tor Project, Inc"
31 31
 # in website/include/versions.wmi. Tags that people usually forget to close,
32 32
 # as well as tags that are not defined in versions.wmi have been added.
33 33
 # See: https://svn.torproject.org/svn/website/trunk/include/versions.wmi
34
-customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <input> <hr> <br> <img> <gitblob> <version-android-components>"`
34
+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>"`
35 35
 
36 36
 # We also need to use the nodefault option of po4a; space separated list
37 37
 # of tags that the module should not try to set by default in any
Browse code

added custom tag for android.wml

Runa A. Sandvik authored on22/03/2010 18:26:38
Showing1 changed files
... ...
@@ -31,7 +31,7 @@ copyright="The Tor Project, Inc"
31 31
 # in website/include/versions.wmi. Tags that people usually forget to close,
32 32
 # as well as tags that are not defined in versions.wmi have been added.
33 33
 # See: https://svn.torproject.org/svn/website/trunk/include/versions.wmi
34
-customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <input> <hr> <br> <img> <gitblob>"`
34
+customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <input> <hr> <br> <img> <gitblob> <version-android-components>"`
35 35
 
36 36
 # We also need to use the nodefault option of po4a; space separated list
37 37
 # of tags that the module should not try to set by default in any
Browse code

update scripts with new custom tag

Runa A. Sandvik authored on19/01/2010 19:02:31
Showing1 changed files
... ...
@@ -31,7 +31,7 @@ copyright="The Tor Project, Inc"
31 31
 # in website/include/versions.wmi. Tags that people usually forget to close,
32 32
 # as well as tags that are not defined in versions.wmi have been added.
33 33
 # See: https://svn.torproject.org/svn/website/trunk/include/versions.wmi
34
-customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <input> <hr> <br> <img>"`
34
+customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <input> <hr> <br> <img> <gitblob>"`
35 35
 
36 36
 # We also need to use the nodefault option of po4a; space separated list
37 37
 # of tags that the module should not try to set by default in any
Browse code

convert to po for all languages under translation/project/website and create the subdirectories needed

Runa A. Sandvik authored on25/09/2009 18:12:04
Showing1 changed files
... ...
@@ -6,8 +6,9 @@
6 6
 # This is Free Software (GPLv3)
7 7
 # http://www.gnu.org/licenses/gpl-3.0.txt
8 8
 #
9
-# This script will convert all of the english wml files to pot files and
10
-# keep them updated.
9
+# This script will convert all of the english wml files to po files, and
10
+# keep them updated. The script will also convert subdirectories that
11
+# exist in the english website module.
11 12
 #
12 13
 # For more information, see the HOWTO and README in
13 14
 # translation/tools/gsoc09.
... ...
@@ -18,11 +19,11 @@
18 19
 # Location of the wml files
19 20
 wmldir="$PWD"
20 21
 
21
-# Location of the pot files.
22
+# Location of the po files.
22 23
 # Assuming that the translation directory is relative to the website
23
-podir="`dirname $wmldir`/translation/projects/website/templates"
24
+podir="`dirname $wmldir`/translation/projects/website"
24 25
 
25
-# Set the copyright holder of the pot files,
26
+# Set the copyright holder of the po files,
26 27
 # for example "The Tor Project, Inc"
27 28
 copyright="The Tor Project, Inc"
28 29
 
... ...
@@ -75,172 +76,185 @@ fi
75 76
 # Create the temp log
76 77
 touch $tmplog
77 78
 
78
-# cd to the right directory so we can commit the files later
79
-cd "$podir"
79
+# We need to find out which language directories we have.
80
+# We also need to excluse the website module directory itself, as well
81
+# as .svn
82
+langdir=`find "$podir" -maxdepth 1 -type d ! -path "$podir" ! -path "$podir/templates" ! -path "*\.*" | sed "s#$podir/##"`
80 83
 
81 84
 # We only need the english wml files, but we do not wish to translate
82 85
 # the eff documents.
83 86
 wml=`find $wmldir -regex '^'$wmldir'/.*en/.*\.wml' -type f | grep -v '^'$wmldir'/eff'`
84 87
 
85
-# For every wml, update po
86
-for file in $wml ; do
88
+# For every language directory, create and/or update the po files.
89
+for lang in $langdir ; do
87 90
 
88
-	# Get the basename of the file we are dealing with
89
-	wmlfile=`basename $file`
91
+	# For every english wml, see if the po needs to be created or
92
+	# updated
93
+	for file in $wml ; do
90 94
 
91
-	# Get the translation priority
92
-	priority=`cat $file | grep "# Translation-Priority" | awk '{print $3}'`
95
+		# Get the basename of the file we are dealing with
96
+		wmlfile=`basename $file`
93 97
 
94
-	# If the file doesn't have a translation-priority, we can assume
95
-	# that it doesn't need to be translated. Skip this file and
96
-	# continue on with the next.
97
-	if [ ! $priority ]
98
-	then
99
-		continue
100
-	fi
98
+		# Get the translation priority
99
+		priority=`cat $file | grep "# Translation-Priority" | awk '{print $3}'`
101 100
 
102
-	# Strip the file for its original extension and add .pot
103
-	pofile="$priority.${wmlfile%%.*}.pot"
101
+		# If the file doesn't have a translation-priority, we can assume
102
+		# that it doesn't need to be translated. Skip this file and
103
+		# continue on with the next.
104
+		if [ ! $priority ]
105
+		then
106
+			continue
107
+		fi
108
+
109
+		# Strip the file for its original extension and add .po
110
+		pofile="$priority.${wmlfile%%.*}.po"
104 111
 
105
-	# Find out what directory the file is in.
106
-	# Also, remove the parth of the path that is $wmldir
107
-	indir=`dirname $file`
112
+		# Find out what directory the file is in.
113
+		# Also, remove the parth of the path that is $wmldir
114
+		indir=`dirname $file`
108 115
 	
109
-	# We need to know what one dir up is
110
-	onedirup=`dirname $indir | sed "s#$wmldir/##"`
111
-
112
-	# We need to have the correct, full path to the pot
113
-	# directory for the file we are working on.
114
-	# Also, did the subdirectory exist prior to running this
115
-	# script? If not, create it now and add it to the
116
-	# repository.
117
-	if [ $onedirup = $wmldir ]
118
-	then
119
-		popath="$podir"
120
-	else
121
-		# We need to know if a subdirectory, such as torbutton,
122
-		# exist in the translation module. If it does not exist,
123
-		# the script will create it in all the directories under
124
-		# translation/projects/website (excluding .svn)
125
-		langdir=`find $(dirname "$podir") -maxdepth 1 -type d ! -path $(dirname "$podir") ! -path "*\.*"`
126
-
127
-		for dir in $langdir ; do
128
-			if [ ! -d "$dir/$onedirup" ]
129
-			then
130
-				svn mkdir "$dir/$onedirup"
131
-			fi
132
-		done
116
+		# We need to know what one dir up is
117
+		onedirup=`dirname $indir | sed "s#$wmldir/##"`
118
+
119
+		# We need to have the correct, full path to the po
120
+		# directory for the file we are working on.
121
+		# Also, did the subdirectory exist prior to running this
122
+		# script? If not, create it now and add it to the
123
+		# repository.
124
+		if [ $onedirup = $wmldir ]
125
+		then
126
+			popath="$podir/$lang"
127
+		else
128
+
129
+			# We need to know if a subdirectory, such as torbutton,
130
+			# exist in the translation module. If it does not exist,
131
+			# the script will create it in all the directories under
132
+			# translation/projects/website (excluding .svn)
133
+			subdir=`find "$podir/$lang" -maxdepth 1 -type d	! -path "$ppodir/$lang" ! -path "*\.*"`
134
+
135
+			for dir in $subdir ; do
136
+				if [ ! -d "$podir/$lang/$onedirup" ]
137
+				then
138
+					svn mkdir "$podir/$lang/$onedirup"
139
+				fi
140
+			done
133 141
 
134
-		# Set the path
135
-		popath="$podir/$onedirup"
136
-	fi
142
+			# Set the path
143
+			popath="$podir/$lang/$onedirup"
144
+
145
+		fi
137 146
 		
138
-	# Check to see if the pot file existed prior to running this
139
-	# script. If it didn't, check if there any files with the same
140
-	# filename, but different priority. If neither of the files
141
-	# exist, create with po4a-gettextize.
142
-	if [ -e "$popath/$pofile" ]
143
-	then
144
-		poexist=1
145
-	elif [ `find $popath -type f -name "*.$filename" | wc -l` -gt "0" ]
146
-	then
147
-		poexist=2
147
+		# Check to see if the po existed prior to running this
148
+		# script. If it didn't, check if there any files with the same
149
+		# filename, but different priority. If neither of the files
150
+		# exist, create with po4a-gettextize.
151
+		if [ -e "$popath/$pofile" ]
152
+		then
153
+			poexist=1
154
+		elif [ `find $popath -type f -name "*.$filename" | wc -l` -gt "0" ]
155
+		then
156
+			poexist=2
148 157
 
149 158
 		# We need to rename the other file
150 159
 		for file in `find $popath -type f -name "*.$filename"` ; do
151 160
 			svn mv "$file" "$popath/$pofile"
152 161
 			echo "$popath/$pofile" > $tmplog
153 162
 		done
154
-	else
155
-		poexist=0
156
-	fi
157
-
158
-	# If the pot file does not exist, convert it with
159
-	# po4a-gettextize, set the right encoding and charset
160
-	# and the correct copyright.
161
-	if [ $poexist = 0 ]
162
-	then
163
-		# Convert it
164
-		po4a-gettextize -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
165
-
166
-		# Check to see if the file exists
167
-		if [ -e "$popath/$pofile" ]
163
+	
164
+		else
165
+			poexist=0
166
+		fi
167
+
168
+		# If the po file does not exist, convert it with
169
+		# po4a-gettextize, set the right encoding and charset
170
+		# and the correct copyright.
171
+		if [ $poexist = 0 ]
168 172
 		then
169
-			# We don't want files without
170
-			# content, so check the file first.
171
-			content=`cat "$popath/$pofile" | grep '^#[.]' | wc -l`
173
+			# Convert it
174
+			po4a-gettextize -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
172 175
 
173
-			# If the file does not have any
174
-			# content, delete it.
175
-			if [ $content = 0 ] 
176
+			# Check to see if the file exists
177
+			if [ -e "$popath/$pofile" ]
176 178
 			then
177
-				rm -f "$popath/$pofile"
179
+				# We don't want files without
180
+				# content, so check the file first.
181
+				content=`cat "$popath/$pofile" | grep '^#[.]' | wc -l`
182
+
183
+				# If the file does not have any
184
+				# content, delete it.
185
+				if [ $content = 0 ] 
186
+				then
187
+					rm -f "$popath/$pofile"
188
+					echo "$popath/$pofile" > $tmplog
189
+				else
190
+					# Set the right encoding and charset, as well
191
+					# as the correct copyright holder.
192
+					sed -i '0,/ENCODING/ s/ENCODING/8bit/' "$popath/$pofile"
193
+					sed -i '0,/CHARSET/ s/CHARSET/utf-8/' "$popath/$pofile"
194
+					sed -i "0,/Free Software Foundation, Inc/ s/Free Software Foundation, Inc/$copyright/" "$popath/$pofile"
195
+				
196
+					# And add it to the repository
197
+					svn add "$popath/$pofile"
198
+					echo "$popath/$pofile" > $tmplog
199
+				fi
200
+			fi
201
+
202
+			# Update the file with po4a-updatepo to make the
203
+			# word wrapping perfect
204
+			po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
205
+
206
+			# Delete the backup
207
+			rm -f "$popath/$pofile~"
208
+		fi
209
+		
210
+		# If the po file does exist, calculate the hash first,
211
+		# then update the file, then calculate the hash again.
212
+		if [ $poexist = 1 ]
213
+		then
214
+			# Calculate the hash before we update the file
215
+			before=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$pofile" | md5sum | cut -d " " -f1`
216
+
217
+			# Update the po file
218
+			po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
219
+
220
+			# Calculate the new hash
221
+			after=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$pofile" | md5sum | cut -d " " -f1`
222
+
223
+			# Delete the backup
224
+			rm -f "$popath/$pofile~"
225
+
226
+			# Now we need to compare the before and after
227
+			# hash. If they match (i.e. nothing has
228
+			# changed), revert the file.
229
+			if [ $before = $after ]
230
+			then
231
+				svn revert "$popath/$pofile"
178 232
 				echo "$popath/$pofile" > $tmplog
179 233
 			else
180
-				# Set the right encoding and charset, as well
181
-				# as the correct copyright holder.
182
-				sed -i '0,/ENCODING/ s/ENCODING/8bit/' "$popath/$pofile"
183
-				sed -i '0,/CHARSET/ s/CHARSET/utf-8/' "$popath/$pofile"
184
-				sed -i "0,/Free Software Foundation, Inc/ s/Free Software Foundation, Inc/$copyright/" "$popath/$pofile"
185
-
186
-				# And add it to the repository
187
-				svn add "$popath/$pofile"
188 234
 				echo "$popath/$pofile" > $tmplog
189 235
 			fi
190 236
 		fi
191
-	fi
192
-		
193
-	# If the pot file does exist, calculate the hash first,
194
-	# then update the file, then calculate the hash again.
195
-	if [ $poexist = 1 ]
196
-	then
197
-		# Calculate the hash before we update the file
198
-		before=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$pofile" | md5sum | cut -d " " -f1`
199
-
200
-		# Update the pot file
201
-		po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
202
-
203
-		# Calculate the new hash
204
-		after=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$pofile" | md5sum | cut -d " " -f1`
205
-
206
-		# Delete the backup
207
-		rm -f "$popath/$pofile~"
208
-
209
-		# Now we need to compare the before and after
210
-		# hash. If they match (i.e. nothing has
211
-		# changed), revert the file.
212
-		if [ $before = $after ]
237
+
238
+		# If a file with the same name but different priority
239
+		# exist, then rename the file (we have done so already)
240
+		# and update it with po4a-updatepo to make sure
241
+		# everything else is ok.
242
+		if [ $poexist = 2 ]
213 243
 		then
214
-			svn revert "$popath/$pofile"
215
-			echo "$popath/$pofile" > $tmplog
216
-		else
217
-			echo "$popath/$pofile" > $tmplog
244
+			# Update the file
245
+			po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
218 246
 		fi
219
-	fi
220
-
221
-	# If a file with the same name but different priority
222
-	# exist, then rename the file (we have done so already)
223
-	# and update it with po4a-updatepo to make sure
224
-	# everything else is ok.
225
-	if [ $poexist = 2 ]
226
-	then
227
-		# Update the file
228
-		po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
229
-	fi
230 247
 	
231
-	# Write to the logfile
232
-	if [ -e $logfile ]
233
-	then
234
-		if [ `cat $tmplog | grep "$popath/$pofile" | wc -l` -eq "0" ]
248
+		# Write to the logfile
249
+		if [ -e $logfile ]
235 250
 		then
236
-			echo "could not process: " "$file" >> $logfile
251
+			if [ `cat $tmplog | grep "$popath/$pofile" | wc -l` -eq "0" ]
252
+			then
253
+				echo "could not process: " "$file" >> $logfile
254
+			fi
237 255
 		fi
238
-	fi
239 256
 
240
-	# Delete the temp log
241
-	rm -f $tmplog
257
+		# Delete the temp log
258
+		rm -f $tmplog
259
+	done
242 260
 done
243
-
244
-	# If you want the script to commit the files automatically,
245
-	# uncomment the following line.
246
-	# svn ci -m 'automatically generated and updated the pot files'
Browse code

if the subdirectory does not exist, create it in all directories under translation/projects/website

Runa A. Sandvik authored on04/09/2009 13:08:27
Showing1 changed files
... ...
@@ -118,14 +118,21 @@ for file in $wml ; do
118 118
 	then
119 119
 		popath="$podir"
120 120
 	else
121
-		popath="$podir/$onedirup"
121
+		# We need to know if a subdirectory, such as torbutton,
122
+		# exist in the translation module. If it does not exist,
123
+		# the script will create it in all the directories under
124
+		# translation/projects/website (excluding .svn)
125
+		langdir=`find $(dirname "$podir") -maxdepth 1 -type d ! -path $(dirname "$podir") ! -path "*\.*"`
126
+
127
+		for dir in $langdir ; do
128
+			if [ ! -d "$dir/$onedirup" ]
129
+			then
130
+				svn mkdir "$dir/$onedirup"
131
+			fi
132
+		done
122 133
 
123
-		# Check if the directory exists. If it doesn't,
124
-		# create it
125
-		if [ ! -d "$podir/$onedirup" ]
126
-		then
127
-			svn mkdir "$podir/$onedirup"
128
-		fi
134
+		# Set the path
135
+		popath="$podir/$onedirup"
129 136
 	fi
130 137
 		
131 138
 	# Check to see if the pot file existed prior to running this
Browse code

remove unused variable (aka a feature)

Runa A. Sandvik authored on04/09/2009 10:06:41
Showing1 changed files
... ...
@@ -116,22 +116,15 @@ for file in $wml ; do
116 116
 	# repository.
117 117
 	if [ $onedirup = $wmldir ]
118 118
 	then
119
-		popath="$podir/$dir"
120
-
121
-		# Check if the directory exists. If it doesn't,
122
-		# create it
123
-		if [ ! -d "$podir/$dir" ]
124
-		then
125
-			svn mkdir "$podir/$dir"
126
-		fi
119
+		popath="$podir"
127 120
 	else
128
-		popath="$podir/$dir/$onedirup"
121
+		popath="$podir/$onedirup"
129 122
 
130 123
 		# Check if the directory exists. If it doesn't,
131
-		# create it.
132
-		if [ ! -d "$podir/$dir/$onedirup" ]
124
+		# create it
125
+		if [ ! -d "$podir/$onedirup" ]
133 126
 		then
134
-			svn mkdir "$podir/$dir/$onedirup"
127
+			svn mkdir "$podir/$onedirup"
135 128
 		fi
136 129
 	fi
137 130
 		
Browse code

put the scripts in website

Runa A. Sandvik authored on16/08/2009 10:11:41
Showing1 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,246 @@
1
+#!/bin/bash
2
+#
3
+# Author: Runa Sandvik, <runa.sandvik@gmail.com>
4
+# Google Summer of Code 2009
5
+#
6
+# This is Free Software (GPLv3)
7
+# http://www.gnu.org/licenses/gpl-3.0.txt
8
+#
9
+# This script will convert all of the english wml files to pot files and
10
+# keep them updated.
11
+#
12
+# For more information, see the HOWTO and README in
13
+# translation/tools/gsoc09.
14
+# 
15
+
16
+### start config ###
17
+
18
+# Location of the wml files
19
+wmldir="$PWD"
20
+
21
+# Location of the pot files.
22
+# Assuming that the translation directory is relative to the website
23
+podir="`dirname $wmldir`/translation/projects/website/templates"
24
+
25
+# Set the copyright holder of the pot files,
26
+# for example "The Tor Project, Inc"
27
+copyright="The Tor Project, Inc"
28
+
29
+# A lot of the wml files have custom tags. These tags have been defined
30
+# in website/include/versions.wmi. Tags that people usually forget to close,
31
+# as well as tags that are not defined in versions.wmi have been added.
32
+# See: https://svn.torproject.org/svn/website/trunk/include/versions.wmi
33
+customtag=`echo $(cat "$wmldir/include/versions.wmi" | awk '{ printf "<%s> " , $2 }' | sed 's/<>//g') "<svnsandbox> <svnwebsite> <input> <hr> <br> <img>"`
34
+
35
+# We also need to use the nodefault option of po4a; space separated list
36
+# of tags that the module should not try to set by default in any
37
+# category. For now, we only need the input tag.
38
+nodefault='<input>'
39
+
40
+# The script can write the name of unprocessed files to a log.
41
+# If you want to enable this option, set the logfile here.
42
+logfile=""
43
+
44
+# This is the temp logfile. Leave this line even if you don't want to
45
+# log. This will be deleted when the script is done.
46
+tmplog="`dirname $wmldir`/tmp.log"
47
+
48
+### end config ###
49
+
50
+# Create a lockfile to make sure that only one instance of the script
51
+# can run at any time.
52
+LOCKFILE=wml2po.lock
53
+
54
+if lockfile -! -l 60 -r 3 "$LOCKFILE"; 
55
+then
56
+	echo "unable to acquire lock" >2
57
+	exit 1
58
+fi
59
+
60
+trap "rm -f '$PWD/$LOCKFILE'" exit
61
+
62
+# Check if translation/projects/website exist, i.e. has been checked out
63
+if [ ! -d $podir ]
64
+then
65
+	echo "Have you remembered to check out translation/projects/website?"
66
+	exit 1
67
+fi
68
+
69
+# If the logfile is set, write the date.
70
+if [ $logfile ]
71
+then
72
+	echo `date` > $logfile
73
+fi
74
+
75
+# Create the temp log
76
+touch $tmplog
77
+
78
+# cd to the right directory so we can commit the files later
79
+cd "$podir"
80
+
81
+# We only need the english wml files, but we do not wish to translate
82
+# the eff documents.
83
+wml=`find $wmldir -regex '^'$wmldir'/.*en/.*\.wml' -type f | grep -v '^'$wmldir'/eff'`
84
+
85
+# For every wml, update po
86
+for file in $wml ; do
87
+
88
+	# Get the basename of the file we are dealing with
89
+	wmlfile=`basename $file`
90
+
91
+	# Get the translation priority
92
+	priority=`cat $file | grep "# Translation-Priority" | awk '{print $3}'`
93
+
94
+	# If the file doesn't have a translation-priority, we can assume
95
+	# that it doesn't need to be translated. Skip this file and
96
+	# continue on with the next.
97
+	if [ ! $priority ]
98
+	then
99
+		continue
100
+	fi
101
+
102
+	# Strip the file for its original extension and add .pot
103
+	pofile="$priority.${wmlfile%%.*}.pot"
104
+
105
+	# Find out what directory the file is in.
106
+	# Also, remove the parth of the path that is $wmldir
107
+	indir=`dirname $file`
108
+	
109
+	# We need to know what one dir up is
110
+	onedirup=`dirname $indir | sed "s#$wmldir/##"`
111
+
112
+	# We need to have the correct, full path to the pot
113
+	# directory for the file we are working on.
114
+	# Also, did the subdirectory exist prior to running this
115
+	# script? If not, create it now and add it to the
116
+	# repository.
117
+	if [ $onedirup = $wmldir ]
118
+	then
119
+		popath="$podir/$dir"
120
+
121
+		# Check if the directory exists. If it doesn't,
122
+		# create it
123
+		if [ ! -d "$podir/$dir" ]
124
+		then
125
+			svn mkdir "$podir/$dir"
126
+		fi
127
+	else
128
+		popath="$podir/$dir/$onedirup"
129
+
130
+		# Check if the directory exists. If it doesn't,
131
+		# create it.
132
+		if [ ! -d "$podir/$dir/$onedirup" ]
133
+		then
134
+			svn mkdir "$podir/$dir/$onedirup"
135
+		fi
136
+	fi
137
+		
138
+	# Check to see if the pot file existed prior to running this
139
+	# script. If it didn't, check if there any files with the same
140
+	# filename, but different priority. If neither of the files
141
+	# exist, create with po4a-gettextize.
142
+	if [ -e "$popath/$pofile" ]
143
+	then
144
+		poexist=1
145
+	elif [ `find $popath -type f -name "*.$filename" | wc -l` -gt "0" ]
146
+	then
147
+		poexist=2
148
+
149
+		# We need to rename the other file
150
+		for file in `find $popath -type f -name "*.$filename"` ; do
151
+			svn mv "$file" "$popath/$pofile"
152
+			echo "$popath/$pofile" > $tmplog
153
+		done
154
+	else
155
+		poexist=0
156
+	fi
157
+
158
+	# If the pot file does not exist, convert it with
159
+	# po4a-gettextize, set the right encoding and charset
160
+	# and the correct copyright.
161
+	if [ $poexist = 0 ]
162
+	then
163
+		# Convert it
164
+		po4a-gettextize -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
165
+
166
+		# Check to see if the file exists
167
+		if [ -e "$popath/$pofile" ]
168
+		then
169
+			# We don't want files without
170
+			# content, so check the file first.
171
+			content=`cat "$popath/$pofile" | grep '^#[.]' | wc -l`
172
+
173
+			# If the file does not have any
174
+			# content, delete it.
175
+			if [ $content = 0 ] 
176
+			then
177
+				rm -f "$popath/$pofile"
178
+				echo "$popath/$pofile" > $tmplog
179
+			else
180
+				# Set the right encoding and charset, as well
181
+				# as the correct copyright holder.
182
+				sed -i '0,/ENCODING/ s/ENCODING/8bit/' "$popath/$pofile"
183
+				sed -i '0,/CHARSET/ s/CHARSET/utf-8/' "$popath/$pofile"
184
+				sed -i "0,/Free Software Foundation, Inc/ s/Free Software Foundation, Inc/$copyright/" "$popath/$pofile"
185
+
186
+				# And add it to the repository
187
+				svn add "$popath/$pofile"
188
+				echo "$popath/$pofile" > $tmplog
189
+			fi
190
+		fi
191
+	fi
192
+		
193
+	# If the pot file does exist, calculate the hash first,
194
+	# then update the file, then calculate the hash again.
195
+	if [ $poexist = 1 ]
196
+	then
197
+		# Calculate the hash before we update the file
198
+		before=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$pofile" | md5sum | cut -d " " -f1`
199
+
200
+		# Update the pot file
201
+		po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
202
+
203
+		# Calculate the new hash
204
+		after=`grep -vE '^("POT-Creation-Date:|#)' "$popath/$pofile" | md5sum | cut -d " " -f1`
205
+
206
+		# Delete the backup
207
+		rm -f "$popath/$pofile~"
208
+
209
+		# Now we need to compare the before and after
210
+		# hash. If they match (i.e. nothing has
211
+		# changed), revert the file.
212
+		if [ $before = $after ]
213
+		then
214
+			svn revert "$popath/$pofile"
215
+			echo "$popath/$pofile" > $tmplog
216
+		else
217
+			echo "$popath/$pofile" > $tmplog
218
+		fi
219
+	fi
220
+
221
+	# If a file with the same name but different priority
222
+	# exist, then rename the file (we have done so already)
223
+	# and update it with po4a-updatepo to make sure
224
+	# everything else is ok.
225
+	if [ $poexist = 2 ]
226
+	then
227
+		# Update the file
228
+		po4a-updatepo -f wml -m "$file" -p "$popath/$pofile" --master-charset utf-8 -o customtag="$customtag" -o nodefault="$nodefault"
229
+	fi
230
+	
231
+	# Write to the logfile
232
+	if [ -e $logfile ]
233
+	then
234
+		if [ `cat $tmplog | grep "$popath/$pofile" | wc -l` -eq "0" ]
235
+		then
236
+			echo "could not process: " "$file" >> $logfile
237
+		fi
238
+	fi
239
+
240
+	# Delete the temp log
241
+	rm -f $tmplog
242
+done
243
+
244
+	# If you want the script to commit the files automatically,
245
+	# uncomment the following line.
246
+	# svn ci -m 'automatically generated and updated the pot files'