Browse code

update po2wml to include Polish *.wmi for Polish *.wml

Runa A. Sandvik authored on30/03/2011 16:08:39
Showing1 changed files
... ...
@@ -117,38 +117,21 @@ for file in $po ; do
117 117
 				sed -i 's/PO4ASHARPEND-->//' "$wmldir/$subdir/$wmlfile"
118 118
 			fi
119 119
 
120
-			# If the file is an Arabic translation, include
121
-			# the right header, css, menu files and footer
122
-			if [ $subdir = "ar" ]
120
+			# Include the English footer for most of the
121
+			# translations
122
+			if [[ $subdir != "ar" && $subdir != "pl" ]]
123 123
 			then
124
-				# Head
125
-				orig_head=`grep '#include "head.wmi"' "$wmldir/$subdir/$wmlfile"`
126
-				temp_head=`echo $orig_head | sed s@head.wmi@ar/head.wmi@`
127
-				new_head=`echo $temp_head 'STYLESHEET="css/master-rtl.css"'`
128
-				sed -i "s@$orig_head@$new_head@" "$wmldir/$subdir/$wmlfile"
129
-
130
-				# Side (not all files include this)
131
-				orig_side=`grep '#include "side.wmi"' "$wmldir/$subdir/$wmlfile"`
132
-				if [ -n "$orig_side" ]
133
-				then
134
-					new_side=`echo '#include "ar/side.wmi"'`
135
-					sed -i "s@$orig_side@$new_side@" "$wmldir/$subdir/$wmlfile"
136
-				fi
137
-
138
-				# Info (not all files include this)
139
-				orig_info=`grep '#include "info.wmi"' "$wmldir/$subdir/$wmlfile"`
140
-				if [ -n "$orig_info" ]
141
-				then
142
-					new_info=`echo '#include "ar/info.wmi"'`
143
-					sed -i "s@$orig_info@$new_info@" "$wmldir/$subdir/$wmlfile"
144
-				fi
145
-
146
-				# Footer
147
-				echo '#include "ar/foot.wmi"' >> "$wmldir/$subdir/$wmlfile"
148
-			else
149
-				# Include the English footer
150 124
 				echo '#include "foot.wmi"' >> "$wmldir/$subdir/$wmlfile"
151 125
 			fi
126
+
127
+			# If the directory does not include sidenav.wmi,
128
+			# copy it from the English directory (only if
129
+			# the English directory has this file)
130
+			if [[ ! -e "$wmldir/$subdir/sidenav.wmi" && -e "$wmldir/en/sidenav.wmi" ]]
131
+			then
132
+				cp "$wmldir/en/sidenav.wmi" "$wmldir/$subdir"
133
+			fi
134
+
152 135
 		fi
153 136
 	}	
154 137
 
... ...
@@ -174,38 +157,20 @@ for file in $po ; do
174 157
 				sed -i "s/$translator_comment//" "$wmldir/$subdir/$lang/$wmlfile"
175 158
 			fi
176 159
 
177
-			# If the file is an Arabic translation, include the
178
-			# right header, css, menu files and footer
179
-			if [ $lang = "ar" ]
160
+			# Include the English footer for most of the
161
+			# translations 
162
+			if [[ $lang != "ar" && $lang != "pl" ]]
180 163
 			then
181
-				# Head
182
-				orig_head=`grep '#include "head.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
183
-				temp_head=`echo $orig_head | sed s@head.wmi@ar/head.wmi@`
184
-				new_head=`echo $temp_head 'STYLESHEET="css/master-rtl.css"'`
185
-				sed -i "s@$orig_head@$new_head@" "$wmldir/$subdir/$lang/$wmlfile"
186
-
187
-				# Side (not all files include this)
188
-				orig_side=`grep '#include "side.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
189
-				if [ -n "$orig_side" ]
190
-				then
191
-					new_side=`echo '#include "ar/side.wmi"'`
192
-					sed -i "s@$orig_side@$new_side@" "$wmldir/$subdir/$lang/$wmlfile"
193
-				fi
194
-
195
-				# Info (not all files include this)
196
-				orig_info=`grep '#include "info.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
197
-				if [ -n "$orig_info" ]
198
-				then
199
-					new_info=`echo '#include "ar/info.wmi"'`
200
-					sed -i "s@$orig_info@$new_info@" "$wmldir/$subdir/$lang/$wmlfile"
201
-				fi
202
-
203
-				# Footer
204
-				echo '#include "ar/foot.wmi"' >> "$wmldir/$subdir/$lang/$wmlfile"
205
-			else
206
-				# Include the English footer
207 164
 				echo '#include "foot.wmi"' >> "$wmldir/$subdir/$lang/$wmlfile"
208 165
 			fi
166
+
167
+			# If the directory does not include sidenav.wmi,
168
+			# copy it from the English directory (only if 
169
+			# the English directory has this file)
170
+			if [[ ! -e "$wmldir/$subdir/$lang/sidenav.wmi" && -e "$wmldir/$subdir/en/sidenav.wmi" ]]
171
+			then
172
+				cp "$wmldir/$subdir/en/sidenav.wmi" "$wmldir/$subdir/$lang/"
173
+			fi
209 174
 		fi
210 175
 	}
211 176
 
... ...
@@ -239,10 +204,76 @@ for file in $po ; do
239 204
 		then
240 205
 			subdir="pl"
241 206
 			nosubdir
207
+
208
+			# If the file was written, include the right
209
+			# header, menu files and footer
210
+			if [ -e "$wmldir/$subdir/$wmlfile" ]
211
+			then
212
+				# Head
213
+				orig_head=`grep '#include "head.wmi"' "$wmldir/$subdir/$wmlfile"`
214
+				new_head=`echo $orig_head | sed s@head.wmi@pl/head.wmi@`
215
+				sed -i "s@$orig_head@$new_head@" "$wmldir/$subdir/$wmlfile"
216
+
217
+				# Side (not all files include this)
218
+				orig_side=`grep '#include "side.wmi"' "$wmldir/$subdir/$wmlfile"`
219
+				if [ -n "$orig_side" ]
220
+				then
221
+					new_side=`echo '#include "pl/side.wmi"'`
222
+					sed -i "s@$orig_side@$new_side@" "$wmldir/$subdir/$wmlfile"
223
+				fi
224
+
225
+				# Info (not all files include this)
226
+				orig_info=`grep '#include "info.wmi"' "$wmldir/$subdir/$wmlfile"`
227
+				if [ -n "$orig_info" ]
228
+				then
229
+					new_info=`echo '#include "pl/info.wmi"'`
230
+					sed -i "s@$orig_info@$new_info@" "$wmldir/$subdir/$wmlfile"
231
+				fi
232
+
233
+				# Footer
234
+				echo '#include "pl/foot.wmi"' >> "$wmldir/$subdir/$wmlfile"
235
+			fi
236
+		fi
237
+
238
+		# If the file is an Arabic translation, include
239
+		# the right header, css, menu files and footer
240
+                if [ $subdir = "ar" ]
241
+		then
242
+			# Convert the file first
243
+			nosubdir
244
+
245
+			# If it was written, do the following
246
+			if [ -e "$wmldir/$subdir/$wmlfile" ]
247
+			then
248
+				# Head
249
+				orig_head=`grep '#include "head.wmi"' "$wmldir/$subdir/$wmlfile"`
250
+				temp_head=`echo $orig_head | sed s@head.wmi@ar/head.wmi@`
251
+				new_head=`echo $temp_head 'STYLESHEET="css/master-rtl.css"'`
252
+				sed -i "s@$orig_head@$new_head@" "$wmldir/$subdir/$wmlfile"
253
+
254
+				# Side (not all files include this)
255
+				orig_side=`grep '#include "side.wmi"' "$wmldir/$subdir/$wmlfile"`
256
+				if [ -n "$orig_side" ]
257
+				then
258
+					new_side=`echo '#include "ar/side.wmi"'`
259
+					sed -i "s@$orig_side@$new_side@" "$wmldir/$subdir/$wmlfile"
260
+				fi
261
+	
262
+				# Info (not all files include this)
263
+				orig_info=`grep '#include "info.wmi"' "$wmldir/$subdir/$wmlfile"`
264
+				if [ -n "$orig_info" ]
265
+				then
266
+					new_info=`echo '#include "ar/info.wmi"'`
267
+					sed -i "s@$orig_info@$new_info@" "$wmldir/$subdir/$wmlfile"
268
+				fi
269
+
270
+				# Footer
271
+				echo '#include "ar/foot.wmi"' >> "$wmldir/$subdir/$wmlfile"
272
+			fi
242 273
 		fi
243 274
 
244 275
 		# Convert everything else
245
-		if [[ $subdir != "en" && $subdir != "zh_CN" && $subdir != "nb" && $subdir != "sv" ]]
276
+		if [[ $subdir != "en" && $subdir != "zh_CN" && $subdir != "nb" && $subdir != "sv" && $subdir != "ar" ]]
246 277
 		then
247 278
 			nosubdir
248 279
 		fi
... ...
@@ -273,10 +304,77 @@ for file in $po ; do
273 304
 		then
274 305
 			lang="pl"
275 306
 			subdir
307
+
308
+			# If the file was written, include the right
309
+			# header, menu files and footer
310
+			if [ -e "$wmldir/$subdir/$lang/$wmlfile" ]
311
+			then
312
+				# Head
313
+				orig_head=`grep '#include "head.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
314
+				new_head=`echo $orig_head | sed s@head.wmi@pl/head.wmi@`
315
+				sed -i "s@$orig_head@$new_head@" "$wmldir/$subdir/$lang/$wmlfile"
316
+
317
+				# Side (not all files include this)
318
+				orig_side=`grep '#include "side.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
319
+				if [ -n "$orig_side" ]
320
+				then
321
+					new_side=`echo '#include "pl/side.wmi"'`
322
+					sed -i "s@$orig_side@$new_side@" "$wmldir/$subdir/$lang/$wmlfile"
323
+				fi
324
+
325
+				# Info (not all files include this)
326
+				orig_info=`grep '#include "info.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
327
+				if [ -n "$orig_info" ]
328
+				then
329
+					new_info=`echo '#include "pl/info.wmi"'`
330
+					sed -i "s@$orig_info@$new_info@" "$wmldir/$subdir/$lang/$wmlfile"
331
+				fi
332
+
333
+				# Footer
334
+				echo '#include "pl/foot.wmi"' >> "$wmldir/$subdir/$lang/$wmlfile"
335
+			fi
336
+
337
+		fi
338
+
339
+		# If the file is an Arabic translation, include the
340
+		# right header, css, menu files and footer
341
+		if [ $lang = "ar" ]
342
+		then
343
+			# Convert the file first
344
+			subdir
345
+
346
+			# If it was written, do the following
347
+			if [ -e "$wmldir/$subdir/$lang/$wmlfile" ]
348
+			then
349
+				# Head
350
+				orig_head=`grep '#include "head.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
351
+				temp_head=`echo $orig_head | sed s@head.wmi@ar/head.wmi@`
352
+				new_head=`echo $temp_head 'STYLESHEET="css/master-rtl.css"'`
353
+				sed -i "s@$orig_head@$new_head@" "$wmldir/$subdir/$lang/$wmlfile"
354
+
355
+				# Side (not all files include this)
356
+				orig_side=`grep '#include "side.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
357
+				if [ -n "$orig_side" ]
358
+				then
359
+					new_side=`echo '#include "ar/side.wmi"'`
360
+					sed -i "s@$orig_side@$new_side@" "$wmldir/$subdir/$lang/$wmlfile"
361
+				fi
362
+
363
+				# Info (not all files include this)
364
+				orig_info=`grep '#include "info.wmi"' "$wmldir/$subdir/$lang/$wmlfile"`
365
+				if [ -n "$orig_info" ]
366
+				then
367
+					new_info=`echo '#include "ar/info.wmi"'`
368
+					sed -i "s@$orig_info@$new_info@" "$wmldir/$subdir/$lang/$wmlfile"
369
+				fi
370
+
371
+				# Footer
372
+				echo '#include "ar/foot.wmi"' >> "$wmldir/$subdir/$lang/$wmlfile"
373
+			fi
276 374
 		fi
277 375
 
278 376
 		# Convert everything else
279
-		if [[ $lang != "en" && $lang != "zh_CN" && $lang != "nb" && $lang != "sv" ]]
377
+		if [[ $lang != "en" && $lang != "zh_CN" && $lang != "nb" && $lang != "sv" && $lang != "ar" ]]
280 378
 		then
281 379
 			subdir
282 380
 		fi