From c763cf047025c91113de5874d566cd37cfa4b8c9 Mon Sep 17 00:00:00 2001 From: odan Date: Tue, 9 Apr 2024 02:20:50 +0900 Subject: [PATCH] add friendly error message if i18n is undefined --- src/withI18Next.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/withI18Next.tsx b/src/withI18Next.tsx index 5984613..17ec623 100644 --- a/src/withI18Next.tsx +++ b/src/withI18Next.tsx @@ -15,6 +15,14 @@ export const withI18Next = ( parameters: {i18n}, } = context; + if (i18n === undefined) { + console.error(`The 'i18n' parameter is missing in 'parameters' configuration of preview.js. Define the 'i18n' parameter as follows: +parameters: { + i18n, +}, +`); + } + const language = i18n?.language; const [{locale}] = useGlobals();