From ddab65bac2501243a4fc8d659585e1e5e70c7c8d Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Mon, 1 Mar 2021 11:48:07 -0500 Subject: [PATCH] do not translate strings containing only digits --- src/extensions/scratch3_translate/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/extensions/scratch3_translate/index.js b/src/extensions/scratch3_translate/index.js index 3c1d4cd19..560eeaeb2 100644 --- a/src/extensions/scratch3_translate/index.js +++ b/src/extensions/scratch3_translate/index.js @@ -247,6 +247,10 @@ class Scratch3TranslateBlocks { * @return {Promise} - a promise that resolves after the response from the translate server. */ getTranslate (args) { + // If the text contains only digits 0-9 and nothing else, return it without + // making a request. + if (/^\d+$/.test(args.WORDS)) return Promise.resolve(args.WORDS); + // Don't remake the request if we already have the value. if (this._lastTextTranslated === args.WORDS && this._lastLangTranslated === args.LANGUAGE) {