crisp-im / crisp-sdk-web

:package: Include the Crisp chat widget from using frameworks such as React, VueJS, Angular...
https://www.npmjs.com/package/crisp-sdk-web
MIT License
40 stars 15 forks source link

Allow setting Crisp's chatbox language after locale change #14

Closed danmartensrf closed 7 months ago

danmartensrf commented 1 year ago

In our current setup (web app running on NextJS), when a user changes the language on the website, he gets redirected to a new url containing the new locale. We have tried re-configuring Crisp with the new locale after the page load and even though the locale is correctly set in the Crisp object, the language of the chatbox does not change to the new locale. You have to do a page refresh for the chatbox language to change accordingly.

It would be great if you could force Crisp's locale via a function and trigger a chatbox re-render when that happens.

Our setup: "crisp-sdk-web": "^1.0.13" "next": "^13.1.6"

eliottvincent commented 7 months ago

Hey! After setting the new locale, you need to refresh the chatbox with: Crisp.session.reset(); (note that this will clear the current conversation).