Discuss Scratch

ispretty
Scratcher
100+ posts

Translate Block Source Code

Can anyone tell me where the
translate () to ( v)
block's dropdown menu is pulled from in Scratch's source code?
ispretty
Scratcher
100+ posts

Translate Block Source Code

awesome-llama wrote:

That block is here: https://github.com/scratchfoundation/scratch-vm/blob/develop/src/extensions/scratch3_translate/index.js#L114-L135
and the menu is a few lines below: https://github.com/scratchfoundation/scratch-vm/blob/develop/src/extensions/scratch3_translate/index.js#L149-L152
I was expecting a list of languages, and I'm not sure what
this._supportedLanguages
is supposed to be referencing since I don't know JS. Could someone help me there?
Pufferfish_Test
Scratcher
500+ posts

Translate Block Source Code

The github repo for the scratch-translate-exrension-languages library (which is where the language list comes from) is private, but the source code can be viewed at https://www.npmjs.com/package/scratch-translate-extension-languages?activeTab=code - the language list is in languages.json. The block menu is built from the menuMap property based on the current kanguage so that thr languages are displayed in the user's locale.

Powered by DjangoBB