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;
if (!translatedMessage) {
translatedMessage = new IntlMessageFormat(
translatedValue,
language,
formats
);
try {
translatedMessage = new IntlMessageFormat(
translatedValue,
language,
formats
);
} catch (err) {
return "Translation error: " + err.message;
}
cache._localizationCache[messageKey] = translatedMessage;
}