From e8eb2add95a736e083d65d209c27512749f5cefc Mon Sep 17 00:00:00 2001 From: anis Date: Sun, 24 Nov 2024 13:11:51 +0100 Subject: [PATCH] Main pipeline established --- .gitignore | 3 +- compare_tools/Mod.py | 7 +- compare_tools/compare_configs.py | 8 +- compare_tools/format_output.py | 4 +- mod_translate_track.py | 12 ++- .../Smart_Inserters/locale/fr/locale.cfg | 90 +++++++++++++++++++ 6 files changed, 111 insertions(+), 13 deletions(-) create mode 100644 mods_locale/Smart_Inserters/locale/fr/locale.cfg diff --git a/.gitignore b/.gitignore index 4cbe91e..0b0f12a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ TODO.MD -*.pyc \ No newline at end of file +*.pyc +output/ \ No newline at end of file diff --git a/compare_tools/Mod.py b/compare_tools/Mod.py index 321de9f..9d5b2ea 100644 --- a/compare_tools/Mod.py +++ b/compare_tools/Mod.py @@ -18,6 +18,9 @@ def __init__(self, mod_url): if not os.path.exists(self.path_en): init_mod(self) + print(f"Mod {self.name} by {self.owner} loaded!") + + def download_locale_en(self, store=True): # download the English version @@ -32,15 +35,13 @@ def download_locale_en(self, store=True): f.write(config_str) return config_str - - def init_mod(mod, overwrite=False): if os.path.exists(mod.path) and not overwrite: raise FileExistsError("Mod folder already exists in repository. Use --f to overwrite.") print(f"Mod {mod.name} by {mod.owner} not intialised. Intialising...") os.makedirs(mod.path_en, exist_ok=overwrite) mod.download_locale_en() - print(f"Locale File downloaded for {mod.name} by {mod.owner}. Ready to translate!") + print(f"Locale File downloaded for {mod.name} by {mod.owner}. Mod intialised!") return mod diff --git a/compare_tools/compare_configs.py b/compare_tools/compare_configs.py index efd0630..bc64382 100644 --- a/compare_tools/compare_configs.py +++ b/compare_tools/compare_configs.py @@ -1,11 +1,13 @@ import argparse -from Mod import Mod +from compare_tools.Mod import Mod import configparser - +import os def parse_config(path_or_string): cfg = configparser.ConfigParser() - cfg.read(path_or_string) + if not os.path.exists(path_or_string): + raise FileNotFoundError(f"missing {path_or_string}") + cfg.read(path_or_string,encoding="utf-8") return {section: dict(cfg.items(section)) for section in cfg.sections()} diff --git a/compare_tools/format_output.py b/compare_tools/format_output.py index a0824a5..fb0279b 100644 --- a/compare_tools/format_output.py +++ b/compare_tools/format_output.py @@ -1,6 +1,6 @@ import argparse -from Mod import Mod -from compare_configs import compare_configs +from compare_tools.Mod import Mod +from compare_tools.compare_configs import compare_configs from configparser import ConfigParser TEXT_DISPLAYED = { diff --git a/mod_translate_track.py b/mod_translate_track.py index ec87945..a77945d 100644 --- a/mod_translate_track.py +++ b/mod_translate_track.py @@ -1,5 +1,5 @@ import re -from compare_tools import Mod +from compare_tools import Mod, compare_configs, format_output def dump_faulty_urls(urls): for url in urls: @@ -12,14 +12,18 @@ def check_urls(urls: list): return sanes -def main(): +def main(language:str): with open("mod_list.txt", "r") as f: urls = f.read().splitlines() urls = check_urls(urls) for url in urls: + print(f"checking mod at: {url}") mod = Mod.Mod(url) - + print(mod.path_en/"locale.cfg") + diff = compare_configs.compare_configs(mod.path_en/"locale.cfg", mod.path / "locale" / language/"locale.cfg") + format_output.format_output(diff,mod) if __name__ == "__main__": - main() \ No newline at end of file + language = "fr" + main(language) \ No newline at end of file diff --git a/mods_locale/Smart_Inserters/locale/fr/locale.cfg b/mods_locale/Smart_Inserters/locale/fr/locale.cfg new file mode 100644 index 0000000..f0847e7 --- /dev/null +++ b/mods_locale/Smart_Inserters/locale/fr/locale.cfg @@ -0,0 +1,90 @@ +[smart-inserters] +welcome=[Smart Inserters] SOme test +[flying-text-smart-inserters] +offset-selector-is-disabled=Offset selector is disabled +required-technology-missing=Required technology missing: "__1__" +out-of-range=Out of range +no-inserter-selected=No inserter selected to perform this action +invalid-position=Invalid position + +[controls] +smart-inserters-drop-rotate=Rotate drop position clockwise +smart-inserters-drop-rotate-reverse=Rotate drop position counterclockwise +smart-inserters-pickup-rotate=Rotate pickup position clockwise +smart-inserters-pickup-rotate-reverse=Rotate pickup position counterclockwise +smart-inserters-drop-distance-adjust=Adjust inserter's drop distance outward +smart-inserters-drop-distance-adjust-reverse=Adjust inserter's drop distance inward +smart-inserters-pickup-distance-adjust=Adjust inserter's pickup distance outward +smart-inserters-pickup-distance-adjust-reverse=Adjust inserter's pickup distance inward +smart-inserters-drop-offset-adjust=Adjust drop offset (closer/farther) +smart-inserters-pickup-offset-adjust=Adjust pickup offset (closer/farther) +smart-inserters-in-world-inserter-configurator-drop=In-world drop position configurator (outside UI) +smart-inserters-in-world-inserter-configurator-pickup=In-world pickup position configurator (outside UI) + +[gui-smart-inserters] +configuration=Configuration +position=pickup/Drop position +drop-offset=Drop offset +pickup-offset=pickup offset + +[mod-setting-name] +si-inserters-chase-belt-items=Chase items on a belt +si-range-adder=Max range of each inserter +si-max-inserters-range=Max inserters range +si-disable-long-inserters=Disable long inserters +si-directional-inserters=Directional Inserters +si-single-line-inserters=Single line for Inserters +si-directional-slim-inserters=Directional Slim Inserters +si-single-line-slim-inserters=Single line for Slim Inserters +si-diagonal-technologies=Diagonal technologies +si-range-technologies=Range technologies +si-offset-technologies=Offset technology +si-offset-selector=Offset selector +si-technologies-difficulty=Technology difficulty +si-disable-inserters-consumption=Disable inserters consumption +si-high-contrast-sprites=High contrast sprites + +[mod-setting-description] +si-inserters-chase-belt-items=Inserter will follow vanilla rules and chase items on belts, following items can cause problems especially UPS problems (suggested =true) +si-range-adder=__REMARK_COLOR_BEGIN__“Inserter"__REMARK_COLOR_END__ each inserter is going to be limited to its range and also be limited by the max range (work best with diagonal technology on, note that if the max range is 1 and the inserter ha range 2 it will not be editable) \n __REMARK_COLOR_BEGIN__"Incremental"__REMARK_COLOR_END__ each inserter will have its range + an increment given by the tech <=max range (work best with range and diagonal technologies) \n __REMARK_COLOR_BEGIN__"Equal”__REMARK_COLOR_END__ every inserter will have the same range (the max range) (work best with range and diagonal technologies) \n__REMARK_COLOR_BEGIN__"Rebase"__REMARK_COLOR_END__ each inserter will have its minimum range updated to it's default range, max range will be the one you decide in the settings (an inserter of range 2 will not be able to place of pick item at range 1) \n__REMARK_COLOR_BEGIN__"incremental-with-rebase"__REMARK_COLOR_END__ same as incremental but inetsad of using the base range the increment start after the rebase \n __REMARK_COLOR_BEGIN__"inserter-with-rebase"__REMARK_COLOR_END__ similar to incremental-with-rebase but instead of adding an increment to the min range it unlock teh range up to the max range (if you want to allow inserter to change position only in their default range set the max range to 1) +si-max-inserters-range=Set the maximum range of the inserters (1-6) (suggested =3) +si-disable-long-inserters=Hides all the recipes for long inserters +si-directional-inserters=Allow inserters to pickup items only from a side and put them on the opposite side +si-single-line-inserters=Inserter will not be able to move diagonally +si-directional-slim-inserters=Allow inserters to pickup items only from a side and put them on the opposite side +si-single-line-slim-inserters=Inserter will not be able to move diagonally +si-diagonal-technologies=Enable diagonal technologies (without level 1 tech the inserter will not be editable) +si-range-technologies=Enable range technologies (without level 1 tech the inserter will not be editable) +si-offset-technologies=Enable offset tech +si-offset-selector=Toggle if you want to have the pickup/drop offset selector on or off (on by default) +si-technologies-difficulty=Select the difficulty of your technology progression, for more info open the mod zip and go to prototypes->technology +si-disable-inserters-consumption=Disable inserters power usare of any kind + +[technology-name] +si-unlock-cross=Unlock cross +si-unlock-x-diagonals=Unlock X diagonals +si-unlock-all-diagonals=Unlock all diagonals +si-unlock-range=Inserters range +si-unlock-offsets=Inserter pickup/drop offset + +[technology-description] +si-unlock-cross= +si-unlock-x-diagonals= +si-unlock-all-diagonals= +si-unlock-offsets= +si-unlock-range-1=5x5 inserters range +si-unlock-range-2=7x7 inserters range +si-unlock-range-3=9x9 inserters range +si-unlock-range-4=11x11 inserters range +si-unlock-range-5=13x13 inserters range + +[technology-effect-description] +si-unlock-cross=Unlock horizontal and vertical mobility +si-unlock-x-diagonals=Unlock 45° rotations +si-unlock-offsets=Unlock pickup/drop offsets +si-unlock-all-diagonals=Unlock 360° rotations +si-unlock-range-1=Unlock 5x5 inserters range or increment by 1 +si-unlock-range-2=Unlock 7x7 inserters range or increment by 2 +si-unlock-range-3=Unlock 9x9 inserters range or increment by 3 +si-unlock-range-4=Unlock 11x11 inserters range or increment by 4 +si-unlock-range-5=Unlock 13x13 inserters range or increment by 5 \ No newline at end of file