Catch translation errors (#9299)

This commit is contained in:
Bram Kragten 2021-05-30 17:02:03 +02:00 committed by GitHub
parent 528af0157d
commit 92c8bd80b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,11 +86,15 @@ export const computeLocalize = async (
| undefined; | undefined;
if (!translatedMessage) { if (!translatedMessage) {
try {
translatedMessage = new IntlMessageFormat( translatedMessage = new IntlMessageFormat(
translatedValue, translatedValue,
language, language,
formats formats
); );
} catch (err) {
return "Translation error: " + err.message;
}
cache._localizationCache[messageKey] = translatedMessage; cache._localizationCache[messageKey] = translatedMessage;
} }