mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-06 02:24:47 -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 ArgumentType = require('../../extension-support/argument-type');
|
||||||
const Cast = require('../../util/cast');
|
const Cast = require('../../util/cast');
|
||||||
const BlockType = require('../../extension-support/block-type');
|
const BlockType = require('../../extension-support/block-type');
|
||||||
|
const formatMessage = require('format-message');
|
||||||
const log = require('../../util/log');
|
const log = require('../../util/log');
|
||||||
const DiffMatchPatch = require('diff-match-patch');
|
const DiffMatchPatch = require('diff-match-patch');
|
||||||
|
|
||||||
|
@ -684,29 +685,51 @@ class Scratch3SpeechBlocks {
|
||||||
getInfo () {
|
getInfo () {
|
||||||
return {
|
return {
|
||||||
id: 'speech',
|
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,
|
menuIconURI: menuIconURI,
|
||||||
blockIconURI: iconURI,
|
blockIconURI: iconURI,
|
||||||
blocks: [
|
blocks: [
|
||||||
{
|
{
|
||||||
opcode: 'listenAndWait',
|
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
|
blockType: BlockType.COMMAND
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
opcode: 'whenIHearHat',
|
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,
|
blockType: BlockType.HAT,
|
||||||
arguments: {
|
arguments: {
|
||||||
PHRASE: {
|
PHRASE: {
|
||||||
type: ArgumentType.STRING,
|
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',
|
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
|
blockType: BlockType.REPORTER
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue