This commit is contained in:
adroitwhiz 2025-05-04 02:06:26 +00:00 committed by GitHub
commit ac4619cd7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1151,7 +1151,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();