From 6b41a7834a06e91cc06e91fb74ac28af73d7cc02 Mon Sep 17 00:00:00 2001 From: grande1900 Date: Sat, 29 Jun 2024 00:08:20 -0400 Subject: [PATCH] Forgot to enable recursion on autolocalize.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤦‍♀️ --- .Stuff for developers/autolocalize.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.Stuff for developers/autolocalize.py b/.Stuff for developers/autolocalize.py index e58df4b4..dde3ac4c 100644 --- a/.Stuff for developers/autolocalize.py +++ b/.Stuff for developers/autolocalize.py @@ -5,26 +5,23 @@ Exclude = input("Exclude: ") import glob import os -def makeTemplate(): - with open(BaseFile, "r", encoding='utf-8') as f: - Template = f.readlines() - Dictionary = {} +Dictionary = {} + +with open(BaseFile, "r", encoding='utf-8') as f: + Template = f.readlines() for i in range(len(Template)): split = Template[i].split(" = ") if Template[i][:2] == "L[": Dictionary[split[1].rstrip()] = (split[0])[2:-1] - return Dictionary -# print(makeTemplate()) - -for path in glob.glob(Directory+'*.lua'): # process - Template = makeTemplate() - if Exclude in path: +for path in glob.iglob(Directory+'/**/*.lua',recursive = True): # process + if len(Exclude) > 0 and Exclude in path: print(f"Excluded file {path}.") continue + print(path) with open(path, 'r+') as lua: content = lua.read() - for key in Template: + for key in Dictionary: content = content.replace(key,f"ARC9:GetPhrase({Template[key]})") lua.seek(0) lua.write(content)