From f4d902e0cddb9046c041e30d55603a60280d595a Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 14 Apr 2021 12:12:07 -0700 Subject: [PATCH] i18n: Ignore missing translation errors from FormatJS. Signed-off-by: Anders Kaseorg --- static/js/i18n.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/static/js/i18n.js b/static/js/i18n.js index 79c7299784..541cc42fde 100644 --- a/static/js/i18n.js +++ b/static/js/i18n.js @@ -1,7 +1,7 @@ // For documentation on i18n in Zulip, see: // https://zulip.readthedocs.io/en/latest/translating/internationalization.html -import {createIntl, createIntlCache} from "@formatjs/intl"; +import {DEFAULT_INTL_CONFIG, IntlErrorCode, createIntl, createIntlCache} from "@formatjs/intl"; import _ from "lodash"; import {page_params} from "./page_params"; @@ -12,6 +12,13 @@ export const intl = createIntl( locale: page_params.default_language, defaultLocale: "en", messages: page_params.translation_data, + onError: /* istanbul ignore next */ (error) => { + // Ignore complaints about untranslated strings that were + // added since the last sync-translations run. + if (error.code !== IntlErrorCode.MISSING_TRANSLATION) { + DEFAULT_INTL_CONFIG.onError(error); + } + }, }, cache, );