More progress with regional names

This commit is contained in:
David Benepe
2022-02-07 11:14:15 -05:00
parent 51f8df1ddf
commit dd8198656b
2 changed files with 17 additions and 7 deletions
+5 -2
View File
@@ -18,7 +18,7 @@ TERMINAL_COLOR_RESET = "\033[0m"
REGIONAL_NAMES_JSON_PATH = 'tools/python/regional_names.json'
# Note: All names MUST be lowercase
diffMap = json.loads(FileUtil.readAllText(REGIONAL_NAMES_JSON_PATH))
diffMap = json.loads(FileUtil.get_text_from_file(REGIONAL_NAMES_JSON_PATH))['diffMap']
def precheckForErrors(version):
versionBuildPath = 'build/' + version
@@ -31,9 +31,12 @@ def precheckForErrors(version):
return None
return symMapPath
def filterSymMapText(symMapText)
def getSymbolsFromMapText(symMapText):
symbols = set()
matches = re.finditer(REGEX_MAP_SYMBOL, symMapText, re.MULTILINE)
for matchNum, match in enumerate(matches, start=1):
@@ -122,7 +125,7 @@ def convertName(convertTo, version):
symMapPath = precheckForErrors(version)
if symMapPath is None:
return
symMapText = FileUtil.get_text_from_file(symMapPath)
symMapText = filterSymMapText(FileUtil.get_text_from_file(symMapPath))
symbols = getSymbolsFromMapText(symMapText)
symbolReplaces = filterOutSymbols(symbols, convertTo)
validReplaces = validateReplaces(symbolReplaces)
+12 -5
View File
@@ -1,5 +1,12 @@
[
{ "us": "color", "uk": "colour" },
{ "us": "gray", "uk": "grey" },
{ "us": "dialog", "uk": "dialogue" }
]
{
"note": "All names must be lower case!",
"diffMap": [
{ "us": "color", "uk": "colour" },
{ "us": "gray", "uk": "grey" },
{ "us": "dialog", "uk": "dialogue" },
{ "us": "dialogs", "uk": "dialogues" },
{ "us": "initialize", "uk": "initialise" }
]
}