From 504ec5b48c1f6ae03546daa4d812b9a37d3fb10e Mon Sep 17 00:00:00 2001 From: object-Object Date: Sun, 10 Sep 2023 01:19:49 -0400 Subject: [PATCH] Localize all of the template text --- .vscode/settings.json | 3 +- doc/properties.toml | 2 - .../hexcasting/lang/en_us.flatten.json5 | 77 +++++++++++++-- .../_templates/common/macros.html.jinja | 2 +- .../_templates/components/navbar.html.jinja | 2 +- .../components/table_of_contents.html.jinja | 4 +- .../_templates/components/welcome.html.jinja | 20 +--- .../_templates/{main.css => main.css.jinja} | 4 +- doc/src/hexdoc/_templates/main.html.jinja | 10 +- doc/src/hexdoc/_templates/main.js.jinja | 4 +- .../pages/hexcasting/brainsweep.html.jinja | 9 +- .../hexcasting/crafting_multi.html.jinja | 9 +- .../hexcasting/manual_pattern.html.jinja | 2 +- .../pages/patchouli/crafting.html.jinja | 7 +- doc/src/hexdoc/patchouli/book.py | 3 + doc/src/hexdoc/patchouli/text/formatting.py | 44 ++++++--- doc/src/hexdoc/scripts/hexdoc.py | 97 +++++++++++++++---- doc/src/hexdoc/utils/jinja_extensions.py | 46 +++++++-- .../doc/properties.toml | 2 - .../hexcasting/lang/en_us.flatten.json5 | 8 ++ pyproject.toml | 2 + 21 files changed, 269 insertions(+), 88 deletions(-) rename doc/src/hexdoc/_templates/{main.css => main.css.jinja} (97%) create mode 100644 doc/{{cookiecutter.output_directory}}/doc/src/{{cookiecutter.__project_slug}}/_export/resources/assets/hexcasting/lang/en_us.flatten.json5 diff --git a/.vscode/settings.json b/.vscode/settings.json index 8ccc103b..a8980e2d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,6 +16,7 @@ "editor.rulers": [120], }, "files.associations": { - "*.js.jinja": "javascript" + "*.js.jinja": "javascript", + "*.css.jinja": "css", } } diff --git a/doc/properties.toml b/doc/properties.toml index 07689a1f..16d27562 100644 --- a/doc/properties.toml +++ b/doc/properties.toml @@ -40,10 +40,8 @@ packages = [ ] [template.args] -title = "Hex Book" mod_name = "Hex Casting" author = "petrak@, Alwinfy" -description = "The Hex Book, all in one place." icon_href = "logo.png" show_landing_text = true diff --git a/doc/src/hexdoc/_export/resources/assets/hexcasting/lang/en_us.flatten.json5 b/doc/src/hexdoc/_export/resources/assets/hexcasting/lang/en_us.flatten.json5 index 01d49917..57829d05 100644 --- a/doc/src/hexdoc/_export/resources/assets/hexcasting/lang/en_us.flatten.json5 +++ b/doc/src/hexdoc/_export/resources/assets/hexcasting/lang/en_us.flatten.json5 @@ -1,16 +1,75 @@ { - key: { - use: "Right Click", - sneak: "Left Shift", - jump: "Space", + hexdoc: { + hexcasting: { + title: "Hex Book", + description: "The Hex Book, all in one place.", }, - "item.minecraft": { - amethyst_shard: "Amethyst Shard", - budding_amethyst: "Budding Amethyst", + welcome: { + "1": "This is the online version of the %s documentation.", + "2": "Embedded images and patterns are included, but not crafting recipes or items. \ + There's an in-game book for those.", + "3": "Additionally, this is built from the latest code on GitHub. \ + It may describe $(bold)newer/$ features that you may not necessarily have, \ + even on the latest Modrinth/CurseForge version!", + "4": "$(bold)Entries which are blurred are spoilers/$. \ + Click to reveal them, but be aware that they may spoil endgame progression. \ + Alternatively, click $(l:?nospoiler)here/$ to get a version with all spoilers showing.", + "old_version": "$(italic)The past is a foreign country; they do things differently there./$", }, - "block.hexcasting": { - slate: "Blank Slate", + toc: { + // use the span tag to make everything after it wrap with the toc button + // or put it at the very end to make the button wrap by itself + // either way, do NOT remove it entirely + title: "Table of {{ ''|safe }}Contents", + toggle_all: "Toggle all", }, + + pattern: { + show: "Click to show spell", + hide: "Click to hide spell", + + multiplier: "${speedScale()}x", + paused: "Paused", + + not_supported: "Your browser does not support visualizing patterns. Pattern code: %s", + }, + + pages: { + patchouli: { + crafting: { + description: "Depicted in the book: The crafting recipe for the", + separator: " and ", + }, + }, + + hexcasting: { + crafting_multi: { + description: "Depicted in the book: Several crafting recipes, for the", + separator: ", ", + }, + + brainsweep: { + description: "Depicted in the book: A mind-flaying recipe producing the", + separator: "", // this value intentionally left blank + }, + }, + }, + }, + + key: { + use: "Right Click", + sneak: "Left Shift", + jump: "Space", + }, + + "item.minecraft": { + amethyst_shard: "Amethyst Shard", + budding_amethyst: "Budding Amethyst", + }, + + "block.hexcasting": { + slate: "Blank Slate", + }, } diff --git a/doc/src/hexdoc/_templates/common/macros.html.jinja b/doc/src/hexdoc/_templates/common/macros.html.jinja index 8c3e5302..0bdf8b47 100644 --- a/doc/src/hexdoc/_templates/common/macros.html.jinja +++ b/doc/src/hexdoc/_templates/common/macros.html.jinja @@ -42,7 +42,7 @@ {# shows the names of all the recipe results in a list of recipes #} {% macro recipe_block(recipes, result_attribute, description, separator) -%}
- Depicted in the book: {{ description }} {{ + {{ description }} {{ recipes |map(attribute="result." ~ result_attribute) |map("hexdoc_wrap", "code") diff --git a/doc/src/hexdoc/_templates/components/navbar.html.jinja b/doc/src/hexdoc/_templates/components/navbar.html.jinja index f6e8ee83..f2a173fa 100644 --- a/doc/src/hexdoc/_templates/components/navbar.html.jinja +++ b/doc/src/hexdoc/_templates/components/navbar.html.jinja @@ -14,7 +14,7 @@ - {{ title }} + {{ _("hexdoc."~props.modid~".title") }} diff --git a/doc/src/hexdoc/_templates/components/table_of_contents.html.jinja b/doc/src/hexdoc/_templates/components/table_of_contents.html.jinja index 8937f791..52012577 100644 --- a/doc/src/hexdoc/_templates/components/table_of_contents.html.jinja +++ b/doc/src/hexdoc/_templates/components/table_of_contents.html.jinja @@ -4,11 +4,11 @@