diff --git a/scripts/languages/twlang.py b/scripts/languages/twlang.py index c682cd282..6508a79c1 100644 --- a/scripts/languages/twlang.py +++ b/scripts/languages/twlang.py @@ -59,12 +59,16 @@ def decode(fileobj, elements_per_key): data[current_key].append(index) if line in data: raise LanguageDecodeError("Key defined multiple times: " + line, fileobj.name, index) - data[(line, current_context)] = [index] + data[(line, current_context)] = [index - 1 if current_context else index] current_key = (line, current_context) if len(data[current_key]) != 1+elements_per_key: raise LanguageDecodeError("Wrong number of elements per key", fileobj.name, index) data[current_key].append(index+1) - return data + new_data = {} + for key, value in data.items(): + if key[0]: + new_data[key] = value + return new_data def check_file(path): @@ -78,7 +82,7 @@ def check_folder(path): for path2, 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()): + if not any(f.endswith(x) for x in [".cpp", ".c", ".h"]): continue for sentence in check_file(os.path.join(path2, f)): englishlist[sentence[1:]] = None