mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-11 04:51:15 -04:00
Fix missing-translation extension warnings
This commit is contained in:
parent
32f87b3396
commit
6cf01bdde1
1 changed files with 4 additions and 1 deletions
|
@ -1120,7 +1120,10 @@ class VirtualMachine extends EventEmitter {
|
|||
* updated for a new locale (or empty if locale hasn't changed.)
|
||||
*/
|
||||
setLocale (locale, messages) {
|
||||
if (locale !== formatMessage.setup().locale) {
|
||||
const {locale: currentLocale, translations} = formatMessage.setup();
|
||||
// The initial locale is English, but at first it does not contain any messages. When we're first passed
|
||||
// English messages, make sure we re-setup with them by checking if the messages have changed.
|
||||
if (locale !== currentLocale || translations[locale] !== messages) {
|
||||
formatMessage.setup({locale: locale, translations: {[locale]: messages}});
|
||||
}
|
||||
return this.extensionManager.refreshBlocks();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue