Skip to content

Commit

Permalink
Merge pull request #29 from odanado/add-friendly-warning-message
Browse files Browse the repository at this point in the history
add friendly error message if i18n is undefined
  • Loading branch information
stevensacks authored Jul 22, 2024
2 parents c9cff72 + c763cf0 commit 1894f6e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/withI18Next.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1894f6e

Please sign in to comment.