Skip to content

Commit

Permalink
Merge commit '89a72309a273bbaa500981ac3d853926470e3235'
Browse files Browse the repository at this point in the history
  • Loading branch information
EphDoering committed Oct 20, 2024
2 parents abf4b1e + 89a7230 commit c1e583c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ launcher.exe
/mods/**

#facotrio files
bin
data
doc-html
*.dat
/saves/**
.lock
Expand Down
2 changes: 1 addition & 1 deletion map_gen_setting_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ def launch_new(*args):
if "can_be_disabled" not in control or control["can_be_disabled"]:
my_menu = autoplace_enable_disable_menu(name, submenu)
else:
my_menu = fa_menu.menu_item(name, submenu)
my_menu = fa_menu.Menu(name, *fa_menu.parse_menu_dict(submenu))
parent[control["name"]] = my_menu
mgs_json["autoplace_controls"][control["name"]] = submenu

Expand Down
16 changes: 12 additions & 4 deletions translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,15 @@ def __missing__(self, key):
return self[key]


plural_compat = re.compile(r"__plural_for_parameter_(\d+)_{")


def plural_compat_replacer(m: re.Match):
return "__plural_for_parameter__" + m[1] + "__{"


def expand(template: str, args: list[localised_str] = []) -> str:
template = plural_compat.sub(plural_compat_replacer, template)
parts = template.split("__")
return expand_r(parts, translated_args(args))

Expand All @@ -196,10 +204,10 @@ def expand_r(parts: list[str], targs: translated_args, in_plural=False):
mrf = repalecement_functions[p]
args = [parts.pop(0) for _ in range(mrf[0])]
ret += mrf[1](*args)
elif "plural_for_parameter_" in p:
sub_parts = p.split("_", 4)
my_num = targs[sub_parts[3]]
remaining = sub_parts[4]
elif p == "plural_for_parameter":
arg_num = parts.pop(0)
my_num = targs[arg_num]
remaining = parts.pop(0)
assert remaining[0] == "{", "Unexpected start of plural. Expected {"
remaining = remaining[1:]
matched = False
Expand Down

0 comments on commit c1e583c

Please sign in to comment.