i18next / i18next-localstorage-backend

This is a i18next cache layer to be used in the browser. It will load and cache resources from localStorage and can be used in combination with the chained backend.
MIT License
88 stars 43 forks source link

Ssr fix #31

Closed BertCatsburg closed 3 years ago

BertCatsburg commented 3 years ago

A simple case of testing the Window variable before use. If not 'window' is available, like in SSR situations, then null is returned for the Store. The function using the store will return undefined, but this is ServerSide. ClientSide will have the 'window' variable and works as before.

Checklist

adrai commented 3 years ago

Did you test this in your next.js app? Does it work as expected?

BertCatsburg commented 3 years ago

Yes, it did. Sorry not to include a full test, but for that I had to set up a complete NextJS environment with all bells and whistles.

I tested it in our company-project by modifying the code in node_modules. Before the change we got an error on the console about the 'window'. After the change the error was gone and all i18n functionality kept on working.

adrai commented 3 years ago

thank you, included in v3.1.3