Downgraded i18n used-before-init error to a warning

- Reworking the location of i18n in boot has fixed the main error
- However, many of our tests depend on i18n being loaded but don't explicitly call init
- There are many ways we could fix this in our tests, but I don't want to spend more time on this now
This commit is contained in:
Hannah Wolfe 2021-05-06 14:02:52 +01:00
parent a2f9204069
commit f63b4d8dcd
No known key found for this signature in database
GPG Key ID: 9F8C7532D0A6BA55
2 changed files with 6 additions and 1 deletions

View File

@ -49,6 +49,10 @@ class ThemeI18n extends i18n.I18n {
return [this.basePath, this._activetheme, 'locales'];
}
_handleUninitialisedError(key) {
throw new errors.IncorrectUsageError({message: `Theme translation was used before it was initialised with key ${key}`});
}
_handleFallbackToDefault() {
this._logging.warn(`Theme translations falling back to locales/${this.defaultLocale()}.json.`);
}

View File

@ -255,7 +255,8 @@ class I18n {
}
_handleUninitialisedError(key) {
throw new errors.IncorrectUsageError({message: `i18n was used before it was initialised with key ${key}`});
this._logging.warn(`i18n was used before it was initialised with key ${key}`);
this.init();
}
_handleFormatError(err) {