Skip to content

Language: Fallback to English if the language don't have the value - #2598

Merged
cjohnson57 merged 3 commits into
OoTRandomizer:Devfrom
JackTriton:Language-Fallback
Jul 2, 2026
Merged

Language: Fallback to English if the language don't have the value#2598
cjohnson57 merged 3 commits into
OoTRandomizer:Devfrom
JackTriton:Language-Fallback

Conversation

@JackTriton

Copy link
Copy Markdown

This allows to fallback texts using English's property.json if the text don't exist in the Language

@fenhl fenhl added Type: Bug Something isn't working Status: Needs Review Someone should be looking at it Status: Needs Testing Probably should be tested Component: Patching Affects the patching of the ROM labels Jun 29, 2026
@fenhl fenhl removed the Status: Needs Review Someone should be looking at it label Jun 29, 2026
@cjohnson57

Copy link
Copy Markdown
Collaborator

Getting this error trying to generate with Japanese on this branch. If I revert to dev I can generate Japanese fine

[Errno 2] No such file or directory: 'C:\\Users\\Caleb\\Repos\\OoT-Randomizer-Tests\\data\\lang\\Japanese\\keaton.bin'
Traceback (most recent call last):
  File "C:\Users\Caleb\Repos\OoT-Randomizer-Tests\OoTRandomizer.py", line 57, in start
    main(settings)
    ~~~~^^^^^^^^^^
  File "C:\Users\Caleb\Repos\OoT-Randomizer-Tests\Main.py", line 57, in main
    patch_and_output(settings, spoiler, rom)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Caleb\Repos\OoT-Randomizer-Tests\Main.py", line 379, in patch_and_output
    patch_cosmetics_log = prepare_rom(spoiler, world, rom, settings, rng_state, restore_rom)
  File "C:\Users\Caleb\Repos\OoT-Randomizer-Tests\Main.py", line 221, in prepare_rom
    patch_rom(spoiler, world, rom)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Caleb\Repos\OoT-Randomizer-Tests\Patches.py", line 67, in patch_rom
    with open(bin_path, 'rb') as stream:
         ~~~~^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Caleb\\Repos\\OoT-Randomizer-Tests\\data\\lang\\Japanese\\keaton.bin'

@JackTriton

Copy link
Copy Markdown
Author

@cjohnson57 I reviewed and found out that the lang.data is also have the fall back as well
This results in unwanted files being requested
I'm thinking to fix this issue by removing the fallback from lang.data since there's no issue with non-patching for bin datas except Blue fire arrow

@JackTriton

Copy link
Copy Markdown
Author

@cjohnson57 I think it's fixed now

@cjohnson57

Copy link
Copy Markdown
Collaborator

@cjohnson57 I think it's fixed now

Now I'm getting this:

'cp932' codec can't encode character '\x82' in position 0: illegal multibyte sequence Traceback (most recent call last): File "C:\Users\Caleb\Repos\OoT-Randomizer-Tests\OoTRandomizer.py", line 57, in start main(settings) ~~~~^^^^^^^^^^ File "C:\Users\Caleb\Repos\OoT-Randomizer-Tests\Main.py", line 57, in main patch_and_output(settings, spoiler, rom) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Caleb\Repos\OoT-Randomizer-Tests\Main.py", line 379, in patch_and_output patch_cosmetics_log = prepare_rom(spoiler, world, rom, settings, rng_state, restore_rom) File "C:\Users\Caleb\Repos\OoT-Randomizer-Tests\Main.py", line 221, in prepare_rom patch_rom(spoiler, world, rom) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Caleb\Repos\OoT-Randomizer-Tests\Patches.py", line 1563, in patch_rom update_message_by_id(messages, text_id, message, lang) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Caleb\Repos\OoT-Randomizer-Tests\Messages.py", line 873, in update_message_by_id text = line_wrap(text, lang.base, align=lang.lang_property["align_text"]) File "C:\Users\Caleb\Repos\OoT-Randomizer-Tests\TextBox.py", line 57, in line_wrap text_codes = Messages.parse_control_codes(text, lang_index) File "C:\Users\Caleb\Repos\OoT-Randomizer-Tests\Messages.py", line 368, in parse_control_codes text_bytes = encode_text_string(text) if lang else encode_text_string_jp(text) ~~~~~~~~~~~~~~~~~~~~~^^^^^^ File "C:\Users\Caleb\Repos\OoT-Randomizer-Tests\Messages.py", line 325, in encode_text_string_jp result.append(int.from_bytes(ch.encode("cp932"), "big")) ~~~~~~~~~^^^^^^^^^ UnicodeEncodeError: 'cp932' codec can't encode character '\x82' in position 0: illegal multibyte sequence encoding with 'cp932' codec failed

@JackTriton

Copy link
Copy Markdown
Author

@cjohnson57 This exact error is caused around update_scrub_messages so I inspect the property.json and assume that PATCH_TEXTS.scrub_texts is causing this
I'll make the patch which will differentiate behavior towards List and Dict

@JackTriton

Copy link
Copy Markdown
Author

@cjohnson57 How about now?
From my test, there are no issue using this fixed one

@cjohnson57

Copy link
Copy Markdown
Collaborator

Yeah seems good now

@cjohnson57
cjohnson57 merged commit 3880405 into OoTRandomizer:Dev Jul 2, 2026
6 checks passed
@cjohnson57 cjohnson57 added this to the next milestone Jul 2, 2026
@fenhl fenhl removed the Status: Needs Testing Probably should be tested label Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Patching Affects the patching of the ROM Type: Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants