Always recreate the language files in same order

Alphabetically as the files are located in directory structure.

Keeps the language files more stable
This commit is contained in:
def 2020-06-28 10:26:02 +02:00
parent edba33be33
commit 59cf78be24
2 changed files with 12 additions and 7 deletions

View file

@ -45,8 +45,11 @@ content = [line for line in content if line != None]
if append_missing:
missing = [index for index in range(len(local)) if index not in supported]
if missing:
for miss in missing:
content.append("\n"+local[miss]+"\n== \n")
if content[-1] != "\n":
content.append("\n")
for i, miss in enumerate(missing):
content.append(local[miss]+"\n== \n\n")
content[-1] = content[-1][:-1]
open(outfile, "w").write("".join(content))
print("Successfully created '"+outfile+"'.")

View file

@ -1,6 +1,6 @@
import os
import re
from collections import OrderedDict
class LanguageDecodeError(Exception):
def __init__(self, message, filename, line):
@ -47,12 +47,14 @@ def check_file(path):
def check_folder(path):
englishlist = set()
for path, _, files in os.walk(path):
for f in files:
englishlist = OrderedDict()
for path, dirs, files in os.walk(path):
dirs.sort()
for f in sorted(files):
if not any(f.endswith(x) for x in ".cpp .c .h".split()):
continue
englishlist.update(check_file(os.path.join(path, f)))
for sentence in check_file(os.path.join(path, f)):
englishlist[sentence] = None
return englishlist