mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
do not translate strings containing only digits
This commit is contained in:
parent
bea802a3b1
commit
ddab65bac2
1 changed files with 4 additions and 0 deletions
|
@ -247,6 +247,10 @@ class Scratch3TranslateBlocks {
|
||||||
* @return {Promise} - a promise that resolves after the response from the translate server.
|
* @return {Promise} - a promise that resolves after the response from the translate server.
|
||||||
*/
|
*/
|
||||||
getTranslate (args) {
|
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.
|
// Don't remake the request if we already have the value.
|
||||||
if (this._lastTextTranslated === args.WORDS &&
|
if (this._lastTextTranslated === args.WORDS &&
|
||||||
this._lastLangTranslated === args.LANGUAGE) {
|
this._lastLangTranslated === args.LANGUAGE) {
|
||||||
|
|
Loading…
Reference in a new issue