Patchouli

Patchouli

168M Downloads

Book in non-English language fails to fallback to English version when missing translated version

3TUSK opened this issue ยท 1 comments

commented

Synopsis

If, for whatever reason(s), a translated book does not override a page of the English version, then that page will not be visible in that target language, and an error will be thrown.

Reproduction

  1. Environment is Forge 14.23.5.2772 and Patchouli 1.0-7.9, dev-env.
  2. assets/[modid]/patchouli_book/[book-name]/en_us/entries/preface/social.json:
{
  "name": "Talk to dev team",
  "icon": "minecraft:writable_book",
  "category": "preface",
  "pages": [
    {
      "type": "text",
      "text": "Lorem ipsum dora sit amet"
    }
  ]
}
  1. Do not put translated version of this page in any target language folders.
  2. Load the game with a non-English locale.
  3. See the following:
    image
  4. Checking the log, found the following:

debug.log excerpt

[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: java.lang.IllegalArgumentException: cuisine:patchouli_books/culinary_101/en_us/entries/preface/social.json does not exist.
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at vazkii.patchouli.client.book.BookContents.loadEntry(BookContents.java:191)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at vazkii.patchouli.client.book.BookContents.lambda$reload$1(BookContents.java:127)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at java.util.ArrayList.forEach(ArrayList.java:1249)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at vazkii.patchouli.client.book.BookContents.reload(BookContents.java:127)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at vazkii.patchouli.common.book.Book.reloadContents(Book.java:194)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at vazkii.patchouli.common.book.Book.reloadContentsAndExtensions(Book.java:182)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at vazkii.patchouli.client.book.gui.GuiBookLanding.actionPerformed(GuiBookLanding.java:187)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at net.minecraft.client.gui.GuiScreen.mouseClicked(GuiScreen.java:494)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at vazkii.patchouli.client.book.gui.GuiBook.mouseClicked(GuiBook.java:244)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at vazkii.patchouli.client.book.gui.GuiBookLanding.mouseClicked(GuiBookLanding.java:157)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:611)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at vazkii.patchouli.client.book.gui.GuiBook.handleMouseInput(GuiBook.java:267)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:576)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1885)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1187)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at net.minecraft.client.Minecraft.run(Minecraft.java:441)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at net.minecraft.client.main.Main.main(Main.java:118)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at java.lang.reflect.Method.invoke(Method.java:498)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at java.lang.reflect.Method.invoke(Method.java:498)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
[11:10:15] [main/INFO] [STDERR]: [vazkii.patchouli.client.book.BookContents:reload:150]: 	at GradleStart.main(GradleStart.java:25)

Analysis

No analysis has been conducted yet.

Final words

According to the wiki page:

Note that creating an "en_us" folder means you're creating the "english" version of your book. The contents you put in the "en_us" folder are always the "main" ones loaded, so even if your book isn't meant to be natively in english, you need to put your main stuff there.

Any translators may create folders with their languages and override any files they wish. They're automatically loaded if the game language is changed. For translators: Please don't include in your folder anything you aren't overriding.

The current behavior seems to mismatch the expected behavior. Therefore, I consider this as a bug.

commented

Further follow-up:

If I click an available entry at that point (i.e. the book shows loading error), game will most likely crash and dump this crash-report: https://paste.ubuntu.com/p/3X9XTVzDRh/. Not sure if it's separate issue, but I will put it here first.