From 3e43786ef66cc9bfd93feee641ad953e10b1af3a Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Thu, 31 May 2018 11:48:37 -0400 Subject: [PATCH] Default to a random language --- src/extensions/scratch3_translate/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/extensions/scratch3_translate/index.js b/src/extensions/scratch3_translate/index.js index f8f559eab..1d0c2ec05 100644 --- a/src/extensions/scratch3_translate/index.js +++ b/src/extensions/scratch3_translate/index.js @@ -42,6 +42,14 @@ class Scratch3TranslateBlocks { return obj; }); + /** + * A randomly selected language code, for use as the default value in the language menu. + * @type {string} + * @private + */ + this._randomLanguageCode = this._supportedLanguages[ + Math.floor(Math.random() * this._supportedLanguages.length)].value; + /** * The result from the most recent translation. * @type {string} @@ -102,7 +110,7 @@ class Scratch3TranslateBlocks { LANGUAGE: { type: ArgumentType.STRING, menu: 'languages', - defaultValue: this._viewerLanguageCode + defaultValue: this._randomLanguageCode } } },