feat(SW-706): use Lokalise
This commit is contained in:
@@ -4,6 +4,8 @@ import { IntlProvider } from "react-intl"
|
||||
|
||||
import type { ClientIntlProviderProps } from "@/types/i18n"
|
||||
|
||||
const logged: Record<string, boolean> = {}
|
||||
|
||||
export default function ClientIntlProvider({
|
||||
children,
|
||||
locale,
|
||||
@@ -15,6 +17,21 @@ export default function ClientIntlProvider({
|
||||
locale={locale}
|
||||
defaultLocale={defaultLocale}
|
||||
messages={messages}
|
||||
onError={(err) => {
|
||||
let msg = err.message
|
||||
|
||||
if (err.code === "MISSING_TRANSLATION") {
|
||||
const id = err.descriptor?.id
|
||||
if (id) {
|
||||
msg = id
|
||||
}
|
||||
}
|
||||
|
||||
if (!logged[msg]) {
|
||||
logged[msg] = true
|
||||
console.warn(err)
|
||||
}
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</IntlProvider>
|
||||
|
||||
Reference in New Issue
Block a user