Skip to content

Commit

Permalink
Main pipeline established
Browse files Browse the repository at this point in the history
  • Loading branch information
anisghaoui committed Nov 24, 2024
1 parent 2abb73a commit e8eb2ad
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
TODO.MD
*.pyc
*.pyc
output/
7 changes: 4 additions & 3 deletions compare_tools/Mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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


Expand Down
8 changes: 5 additions & 3 deletions compare_tools/compare_configs.py
Original file line number Diff line number Diff line change
@@ -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()}

Expand Down
4 changes: 2 additions & 2 deletions compare_tools/format_output.py
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
12 changes: 8 additions & 4 deletions mod_translate_track.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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()
language = "fr"
main(language)
90 changes: 90 additions & 0 deletions mods_locale/Smart_Inserters/locale/fr/locale.cfg
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e8eb2ad

Please sign in to comment.