Giter VIP home page Giter VIP logo

Comments (5)

jamuhl avatar jamuhl commented on June 16, 2024 1

Ah, i see. There is not much we can do in this case...it's just a detector and persisting mechanism. While there is an options expiration for cookies - there is nothing similar to localStorage. Also resetting that automatically might lead to more problems the road down as users might not want that.

Like always the best option is to give your users an option to toggle that language - this way they can change the language anytime it gets added.

from i18next-browser-languagedetector.

jamuhl avatar jamuhl commented on June 16, 2024

Can you more explain what you mean by:

My user accessed the app before I added their browser's default language. Now they see English instead of French.

How do you set the language?!?

from i18next-browser-languagedetector.

dcworldwide avatar dcworldwide commented on June 16, 2024

Not sure why the extra punctuation.

I don't set it explicitly. I use this plugin to automatically detect the language.

Scenario in detail:

  • User accessed app before French translations existed.
  • This plugin (or i18n-next react?) set a local storage prop (i18nextLng) to EN.
  • I deployed a new version of the app containing French translations
  • The user still sees English.

So basically I have users who should now see French translations (because that is their navigator.language prop, but instead see English because of the LS i18nextLng prop.

from i18next-browser-languagedetector.

ekryski avatar ekryski commented on June 16, 2024

Like always the best option is to give your users an option to toggle that language - this way they can change the language anytime it gets added.

FWIW that's what we do @bidalihq.

You can also get them to manually run localStorage.clear() in their console. 🤷‍♂️

from i18next-browser-languagedetector.

strarsis avatar strarsis commented on June 16, 2024

For react-query I added the locale/language that is also sent to the API (Accept-Language HTTP request header) to the cache key (array). I hope this allows to easily invalidate the request caches when the locale is changed.

from i18next-browser-languagedetector.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.