about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2009-06-15 07:34:25 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2009-06-15 07:34:25 +0000
commitab171f8f303306f5b45e2ccaa4c47404b11b0256 (patch)
tree379a16543832b67012694d04b077b666efafd9f1 /scripts
parentf9ef0293ff882b97cfe650e92fe0844c8920f4e3 (diff)
downloadzcatch-ab171f8f303306f5b45e2ccaa4c47404b11b0256.tar.gz
zcatch-ab171f8f303306f5b45e2ccaa4c47404b11b0256.zip
updated localization
Diffstat (limited to 'scripts')
-rw-r--r--scripts/update_localization.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/update_localization.py b/scripts/update_localization.py
index 087f55a4..d3c948aa 100644
--- a/scripts/update_localization.py
+++ b/scripts/update_localization.py
@@ -38,16 +38,20 @@ def load_languagefile(filename):
 
 
 def generate_languagefile(outputfilename, srctable, loctable):
-	f = file(outputfilename, "w")
+	tmpfilename = outputfilename[:-1]+"_"
+	f = file(tmpfilename, "w")
 
 	num_items = 0
 	new_items = 0
 	old_items = 0
 
+	srctable_keys = srctable.keys()
+	srctable_keys.sort()
+
 	print >>f, ""
 	print >>f, "##### translated strings #####"
 	print >>f, ""
-	for k in srctable:
+	for k in srctable_keys:
 		if k in loctable and len(loctable[k]):
 			print >>f, k
 			print >>f, "==", loctable[k]
@@ -57,7 +61,7 @@ def generate_languagefile(outputfilename, srctable, loctable):
 
 	print >>f, "##### needs translation ####"
 	print >>f,  ""
-	for k in srctable:
+	for k in srctable_keys:
 		if not k in loctable or len(loctable[k]) == 0:
 			print >>f, k
 			print >>f, "==", srctable[k]
@@ -78,6 +82,8 @@ def generate_languagefile(outputfilename, srctable, loctable):
 	print "%-40s %8s %8s %8s" % ("filename", "total", "new", "old")
 	print "%-40s %8d %8d %8d" % (outputfilename, num_items, new_items, old_items)
 	f.close()
+	
+	os.rename(tmpfilename, outputfilename)
 
 srctable = parse_source()