Skip to content

Conversation

@tracygardner
Copy link
Contributor

Motivation

  • Make toolbox search return results based on the full visible block label in the active language rather than only block type names and dropdown/field snippets.
  • Ensure indexed text reflects runtime language changes so search results remain localized.
  • Preserve and extend existing keyword and field/dropdown indexing to keep search robust.

Description

  • Added a custom index builder in main/blocklyinit.js that constructs a searchable text for each toolbox block by collecting type, keyword (including blockInfo.full.keyword), field text, dropdown options, and the block’s rendered label via block.toString() with a translated message0 fallback using Blockly.utils.replaceMessageReferences and translate().
  • Indexing uses a temporary Blockly.Workspace which is disposed after building the index, and the category’s blockSearcher.indexBlocks is replaced with a rebuildSearchIndex function so the index can be rebuilt on demand; the search category is exposed at workspace.flockSearchCategory.
  • Hooked into the language-change flow in main/translation.js to call workspace.flockSearchCategory.blockSearcher.indexBlocks() after setLanguage refreshes toolbox and blocks so the search index is retranslated to the active language.

Testing

  • No automated tests were run for these changes.

Codex Task

@tracygardner tracygardner merged commit b5bcef8 into main Jan 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants