summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-06-01 17:18:44 +0200
committerRémi Verschelde <remi@verschelde.fr>2016-06-01 17:18:44 +0200
commit5b9ff5f494055f20b2fbb655a52556b77796e906 (patch)
treeca037b76ee549cbc8d4d560979c755dc2ea95c66 /tools
parent33bb0491f8b1794875ee9b7c858054c86ecb872f (diff)
parent4192d6d5512611825c777aea7af0c8a9478ee290 (diff)
Merge pull request #4976 from J08nY/issue-4947
Sort translations
Diffstat (limited to 'tools')
-rw-r--r--tools/SCsub17
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/SCsub b/tools/SCsub
index 7a0feb6e3d..f6c14a13fb 100644
--- a/tools/SCsub
+++ b/tools/SCsub
@@ -21,17 +21,20 @@ def make_translations_header(target,source,env):
g.write("#ifndef _EDITOR_TRANSLATIONS_H\n")
g.write("#define _EDITOR_TRANSLATIONS_H\n")
+ import zlib
+ import os.path
+
+ paths = [node.srcnode().abspath for node in source]
+ sorted_paths = sorted(paths, key=lambda path: os.path.splitext(os.path.basename(path))[0])
+
xl_names=[]
- for i in range(len(source)):
- print("Appending translation: "+source[i].srcnode().abspath)
- f = open(source[i].srcnode().abspath,"rb")
+ for i in range(len(sorted_paths)):
+ print("Appending translation: "+sorted_paths[i])
+ f = open(sorted_paths[i],"rb")
buf = f.read()
decomp_size = len(buf)
- import zlib
- import os.path
buf = zlib.compress(buf)
-
- name = os.path.splitext(os.path.basename(source[i].srcnode().abspath))[0]
+ name = os.path.splitext(os.path.basename(sorted_paths[i]))[0]
#g.write("static const int _translation_"+name+"_compressed_size="+str(len(buf))+";\n")
#g.write("static const int _translation_"+name+"_uncompressed_size="+str(decomp_size)+";\n")