mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-05-18 01:11:10 -04:00
Turn speech block text into i18n messages. (#1224)
* Turn speech block text into i18n messages. * Update message descriptions and other code review comments. * fix typo * Add bit about not translating Google to message description. * Change default when I hear text
This commit is contained in:
parent
bd83d66bff
commit
ed78231fe9
1 changed files with 28 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
|||
const ArgumentType = require('../../extension-support/argument-type');
|
||||
const Cast = require('../../util/cast');
|
||||
const BlockType = require('../../extension-support/block-type');
|
||||
const formatMessage = require('format-message');
|
||||
const log = require('../../util/log');
|
||||
const DiffMatchPatch = require('diff-match-patch');
|
||||
|
||||
|
@ -684,29 +685,51 @@ class Scratch3SpeechBlocks {
|
|||
getInfo () {
|
||||
return {
|
||||
id: 'speech',
|
||||
name: 'Google Speech',
|
||||
name: formatMessage({
|
||||
id: 'speech.extensionName',
|
||||
default: 'Google Speech',
|
||||
description: 'Name of extension that adds speech recognition blocks. Do Not translate Google.'
|
||||
}),
|
||||
menuIconURI: menuIconURI,
|
||||
blockIconURI: iconURI,
|
||||
blocks: [
|
||||
{
|
||||
opcode: 'listenAndWait',
|
||||
text: 'Listen and Wait',
|
||||
text: formatMessage({
|
||||
id: 'speech.listenAndWait',
|
||||
default: 'listen and wait',
|
||||
// eslint-disable-next-line max-len
|
||||
description: 'Start listening to the microphone and wait for a result from the speech recognition system.'
|
||||
}),
|
||||
blockType: BlockType.COMMAND
|
||||
},
|
||||
{
|
||||
opcode: 'whenIHearHat',
|
||||
text: 'When I hear [PHRASE]',
|
||||
text: formatMessage({
|
||||
id: 'speech.whenIHear',
|
||||
default: 'when I hear [PHRASE]',
|
||||
// eslint-disable-next-line max-len
|
||||
description: 'Event that triggers when the text entered on the block is recognized by the speech recognition system.'
|
||||
}),
|
||||
blockType: BlockType.HAT,
|
||||
arguments: {
|
||||
PHRASE: {
|
||||
type: ArgumentType.STRING,
|
||||
defaultValue: 'cat'
|
||||
defaultValue: formatMessage({
|
||||
id: 'speech.defaultWhenIHearValue',
|
||||
default: 'let\'s go',
|
||||
description: 'The default phrase/word that, when heard, triggers the event.'
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
opcode: 'getSpeech',
|
||||
text: 'speech',
|
||||
text: formatMessage({
|
||||
id: 'speech.speechReporter',
|
||||
default: 'speech',
|
||||
description: 'Get the text of spoken words transcribed by the speech recognition system.'
|
||||
}),
|
||||
blockType: BlockType.REPORTER
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue