Skip to content

Storybook: Adding language bookmarks - #2712

Open
alcole2 wants to merge 6 commits into
mainfrom
language-bookmarks
Open

Storybook: Adding language bookmarks#2712
alcole2 wants to merge 6 commits into
mainfrom
language-bookmarks

Conversation

@alcole2

@alcole2 alcole2 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

TOC (table of contents), EN, and ES bookmark tabs have been added to the storybook menu to allow players to filter quests by language and still search through a single mixed list. I updated quest.gd and individual .tres quest files with ISO 639 language codes ("en" and "es") so the storybook can categorize the quests by this. Selecting a bookmark compares each quest's ISO code with it and filters the master _all_quests array, making a new list with only the matching language quests to show on the page. I also had to update func _on_left_button_pressed() to get players back to the table of contents or previous pages whenever they flip past page 0.

Resolves #2548

TOC (table of contents), EN, and ES bookmark tabs have been added to the storybook menu to allow players to filter quests by language and still search through a single mixed list. I updated quest.gd and individual .tres quest files with ISO 639 language codes ("en" and "es") so the storybook can categorize the quests by this. Selecting a bookmark compares each quest's ISO code with it and filters the master _all_quests array, making a new list with only the matching language quests to show on the page. I also had to update func _on_left_button_pressed() to get players back to the table of contents or previous pages whenever they flip past page 0.
@github-actions

Copy link
Copy Markdown

Play this branch at https://play.threadbare.game/branches/endlessm/language-bookmarks/.

(This launches the game from the start, not directly at the change(s) in this pull request.)

@manuq manuq left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great start and already working! In addition to the quests variable handling request:

The page is empty for "es" in Dev Archipelago storybooks:

Image

Should a language bookmark/section appear if there are no quests for that language? The page would be empty so I don't think so.

Should language bookmarks/sections appear at all if all the quests have the same language? The content of that section would be the same as the table of contents, so I don't think so.

The bookmarks are now hardcoded to the existing StoryQuest languages. But what will happen when a StoryQuest in a different language is added? Maybe it's fine for now, as I don't expect contributions in languages that we can't review (note to self: we should document that somewhere).

Minor detail: the buttons fade in and out when the pages flip. They should stay in place, considering that they are not part of the pages content.

Comment thread scenes/menus/storybook/components/storybook.gd Outdated
Comment on lines +64 to +65
# Saving a copy of all quests
_all_quests = quests.duplicate()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does:

_all_quests = quests.duplicate()

Then show_table_of_contents() does:

quests = _all_quests.duplicate()

While it works, it's a bit odd that the script changes the exported quests property. An exported property is supposed to be changed from the outside (from the user of this storybook).

Instead, add a _flltered_quests internal property. And change _populate_quest_lists() to use _filtered_quests. Consider it the variable containing the filtered view. In show_table_of_contents() do:

_filtered_quests = quests

Note that there is no need for duplicate() at all. In the same way the filter() calls in the per-language handlers don't duplicate the quests. Arrays in Godot are always passed by reference.

alcole2 and others added 4 commits August 14, 2026 10:50
Co-authored-by: Manuel Quiñones <manuq@endlessaccess.org>
I added two Spanish and one French quests. The questss that aren't in English are also put into seperate lists for their respective language. They are actually assigned a language in the loop that appends them to the array so they can be filtered by the bookmarks.
- Hide unused language tabs by evaluating `_all_quests` on ready. This prevents players from clicking into empty quest lists when there aren't any any quests for that specific language.

- Remove all language tabs if all quests share the same language. _all_quests is inspected during _update_bookmark_visibility() to count unique language codes. If only one code exists in the array, the function sets the visibility of the language filter buttons to false.

- Reparent `BookmarkContainer` outside `%StoryBookContent`. This keeps the tab buttons on the screen instead of fading in and out during page flip animations.
@alcole2
alcole2 marked this pull request as ready for review August 17, 2026 12:38
@alcole2
alcole2 requested a review from a team as a code owner August 17, 2026 12:38
@alcole2
alcole2 requested a review from manuq August 17, 2026 12:38
- Introduced `_filtered_quests` property to represent the active quest view (TOC or language).
- Replaced `quests.duplicate()` calls in initialization and filtering functions with direct assignments and array references.

- Updated UI generation (`_populate_quest_lists`, `_create_quest_button`) and page visibility functions to use `_filtered_quests`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tabs, bookmarks, or some other form of organization for the Storyquests in the book

2 participants