QuiiBz / next-international

Type-safe internationalization (i18n) for Next.js
https://next-international.vercel.app
MIT License
1.25k stars 59 forks source link

Improve error messaging for unknown locale key #251

Closed ichiwa closed 10 months ago

ichiwa commented 10 months ago

Is your feature request related to a problem? Please describe. I encountered an Internal error: TypeError: locales[locale] is not a function during the initial setup, which got me a bit stuck. The cause was a trivial mistake of having a wrong key for the locale object.

Describe the solution you'd like I personally think it would be helpful if an error informs us when an unknown locale key is passed. Something along the lines of "An unknown locale string has been passed."

Additional context I do have the desire to create a PR if I find the time. By the way, this is a great library, thank you!

QuiiBz commented 10 months ago

That's a great idea, thanks for creating an issue. Would love to review a PR from you since you're interested!