Commit 972a6506 authored by Zach Pomerantz's avatar Zach Pomerantz Committed by GitHub

fix: do not double-report i18n exception (#6308)

parent 39a212f7
import { i18n } from '@lingui/core' import { i18n } from '@lingui/core'
import { I18nProvider } from '@lingui/react' import { I18nProvider } from '@lingui/react'
import * as Sentry from '@sentry/react'
import { DEFAULT_LOCALE, SupportedLocale } from 'constants/locales' import { DEFAULT_LOCALE, SupportedLocale } from 'constants/locales'
import { import {
af, af,
...@@ -83,9 +82,8 @@ export async function dynamicActivate(locale: SupportedLocale) { ...@@ -83,9 +82,8 @@ export async function dynamicActivate(locale: SupportedLocale) {
const catalog = await import(`locales/${locale}.js`) const catalog = await import(`locales/${locale}.js`)
// Bundlers will either export it as default or as a named export named default. // Bundlers will either export it as default or as a named export named default.
i18n.load(locale, catalog.messages || catalog.default.messages) i18n.load(locale, catalog.messages || catalog.default.messages)
} catch (error) { } catch (error: unknown) {
console.error(error) console.error(new Error(`Unable to load locale (${locale}): ${error}`))
Sentry.captureException(new Error(`Unable to load locale (${locale})`))
} }
i18n.activate(locale) i18n.activate(locale)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment