updated the script to handle xx_XX language codes
Runa A. Sandvik

Runa A. Sandvik commited on 2011-07-21 00:37:42
Zeige 1 geänderte Dateien mit 16 Einfügungen und 28 Löschungen.

... ...
@@ -373,17 +373,18 @@ for file in $po ; do
373 373
 	# subdirectory.
374 374
 	if [ $onedirup == $lang ]
375 375
 	then
376
-		# If the current subdirectory is "zh_CN" use "zh-cn" instead
377
-		if [ $subdir = "zh_CN" ]
376
+		# If the current subdirectory is of the form "xx_XX",
377
+		# rename to "xx-xx" instead (except for pl_PL)
378
+		if [[ $subdir =~ "_" && $subdir != "pl_PL" ]]
378 379
 		then
379
-			subdir="zh-cn"
380
+			subdir="`echo $subdir | sed s/_/-/ | tr '[A-Z]'	'[a-z]'`"
380 381
 			nosubdir
381 382
 		fi
382 383
 
383
-		# If the current subdirectory is "pt_BR" use "pt-br" instead
384
-		if [ $subdir = "pt_BR" ]
384
+		# If the current directory is "pl_PL" use "pl" instead
385
+		if [ $subdir = "pl_PL" ]
385 386
 		then
386
-			subdir="pt-br"
387
+			subdir="pl"
387 388
 			nosubdir
388 389
 		fi
389 390
 
... ...
@@ -401,30 +402,24 @@ for file in $po ; do
401 402
 			nosubdir
402 403
 		fi
403 404
 
404
-		# If the current directory is "pl_PL" use "pl" instead
405
-		if [ $subdir = "pl_PL" ]
406
-		then
407
-			subdir="pl"
408
-			nosubdir
409
-		fi
410
-
411 405
 		# Convert everything else
412
-		if [[ $subdir != "en" && $subdir != "zh_CN" && $subdir != "pt_BR" && $subdir != "nb" && $subdir != "sv" && $subdir != "pl_PL" ]]
406
+		if [[ $subdir != "en" && $subdir != "pl_PL" && ! ($subdir =~ "_") && $subdir != "nb" && $subdir != "sv" ]]
413 407
 		then
414 408
 			nosubdir
415 409
 		fi
416 410
 	else
417
-		# If the current language is "zh_CN" use "zh-cn" instead
418
-		if [ $lang = "zh_CN" ]
411
+		# If the current languge is of the form "xx_XX", rename
412
+		# to "xx-xx" instead (except for pl_PL)
413
+		if [[ $lang =~ "_" && $subdir != "pl_PL" ]]
419 414
 		then
420
-			lang="zh-cn"
415
+			lang="`echo $lang | sed s/_/-/ | tr '[A-Z]' '[a-z]'`"
421 416
 			subdir
422 417
 		fi
423 418
 
424
-		# If the current language is "pt_BR" use "pt-br" instead
425
-		if [ $lang = "pt_BR" ]
419
+		# If the current language is "pl_PL" use "pl" instead
420
+		if [ $lang = "pl_PL" ]
426 421
 		then
427
-			lang="pt-br"
422
+			$lang="pl"
428 423
 			subdir
429 424
 		fi
430 425
 
... ...
@@ -442,15 +437,8 @@ for file in $po ; do
442 437
 			subdir
443 438
 		fi
444 439
 	
445
-		# If the current language is "pl_PL" use "pl" instead
446
-		if [ $lang = "pl_PL" ]
447
-		then
448
-			lang="pl"
449
-			subdir
450
-		fi
451
-
452 440
 		# Convert everything else
453
-		if [[ $lang != "en" && $lang != "zh_CN" && $lang != "pt_BR" && $lang != "nb" && $lang != "sv" && $lang != "pl_PL" ]]
441
+		if [[ $lang != "en" && $lang != "pl_PL" && ! ($lang =~ "_") && $lang != "nb" && $lang != "sv" ]]
454 442
 		then
455 443
 			subdir
456 444
 		fi
457 445