jmoenig / Snap

a visual programming language inspired by Scratch
http://snap.berkeley.edu
GNU Affero General Public License v3.0
1.47k stars 739 forks source link

Improvements to Libraries + Media Browsing for Search #3353

Closed cycomachead closed 1 month ago

cycomachead commented 1 month ago

This isn't a dramatic change, but a meaningful quality of life improvement.

Libraries Dialog

Screenshot 2024-05-11 at 4 00 30 PM

Search

Search acts similarly to the project search. It's a simple substring search.

Block Specs / Updating Script

To get the block specs I ran ruby utilities/add_blocks_to_libraries.rb This parses the blocks from each library's XML file

Translations for blockspecs

Right now, I haven't addressed this. The vast majority of library blocks have no translations. What's tricky is that in the current schema, I assume you are either using the english translation or the current language, but they aren't 'merged'.

If only some block specs are translated, then we should likely 'merge' the English + translated specs. But this was kind of annoying to think about...

Additionally, the custom translations of symbols are only in English right now.

Media file schema.

This is documented in code, but it's like this. Everything other than name and fileName is optional.

{
  "fileName": "",
  "name": "",
  "description": "",
  "categories": [],
  "searchData": [],
  "translations": {
     "de": { ... },
     "es": { ... },
     ...
  }
}

This moves the translations from each individual language file to the media file. I've copied over what's currently translated, but not yet removed the original translations.

IMO, this will make it easier to incrementally translate names and descriptions. If we do update the English name or description, we no longer break the translation.

I'm not expecting the categories array to be translated, since those are likely to live in the individual translations files already (in the case of blocks) OR could be added for costumes instead of repeating translations many times.

There's no searchData or categories for any of costumes, backgrounds or sounds, but obviously there's been interest in adding that data before...

ego-lay-atman-bay commented 1 month ago

For the block specs, couldn't you do what the search box in the block pallet does?