i18next / i18next-browser-languageDetector

language detector used in browser environment for i18next
MIT License
873 stars 90 forks source link

Validate localStorage and sessionStorage only if I use these resources #222

Closed robertymb closed 4 years ago

robertymb commented 4 years ago

Our application is not using sessionStorage or localStorage.

hasLocalStorageSupport and hasSessionStorageSupport validates if browser has support to these resources.

However, sessionStorage.setItem and localStorage.setItem are called in the import and I don't want that because my application cannot have any kind of cookies, sessionStorage or localStorage.

Although it's removed right after, history is there to let users know some kind of cookie was added:

cookies cookies-history

This fix avoid this scenario:

no-cookies

Checklist

robertymb commented 4 years ago

@adrai lemme know if need more information about it.

adrai commented 4 years ago

like this it creates the test item each time... can you change the implementation to cache the result?

robertymb commented 4 years ago

Got it! Lemme check.

adrai commented 4 years ago

lgtm... will merge asap

robertymb commented 4 years ago

Thank you so much! :)

I appreciate your time and help.

adrai commented 4 years ago

included in v6.0.1

If you like this module don’t forget to star this repo. Make a tweet, share the word or have a look at our https://locize.com to support the devs of this project.

There are many ways to help this project 🙏

robertymb commented 4 years ago

Definitely will do. Thank you @adrai