walterholohan / react-native-crisp-chat-sdk

React-Native bridge for Crisp Chat iOS and Android SDK's
MIT License
70 stars 26 forks source link

Chatbox language is always English #21

Closed Yhnlvy closed 1 year ago

Yhnlvy commented 3 years ago

Hi there!

First of all, thank you very much for the great work :)

I have an issue with the "example" project : the chatbox language is always English.

Please find hereafter the context to reproduce it:

Nonetheless, when I run the example from the library on iOS simulator or a real device, the displayed language is still English. The same issue happens if the chatbox language detection is automatic.

Any clue?

Thanks for your help!

minuitagency commented 3 years ago

Hey, same issue, would be super helpful to be able to change the language! Thanks

walterholohan commented 3 years ago

Hi guys,

Ive just left a message on the Crisp iOS SDK github page to see if this is possible to do. Hopefully we can resolve it soon.

Ill also investigate if there is a flag in info.plist that you can set in order to set the default language of the app.

Yhnlvy commented 3 years ago

Hi guys,

Ive just left a message on the Crisp iOS SDK github page to see if this is possible to do. Hopefully we can resolve it soon.

Ill also investigate if there is a flag in info.plist that you can set in order to set the default language of the app.

Hi @walterholohan, and thanks for the quick reply.

Fun fact: I already asked an engineer of the Crisp iOS SDK team to investigate the issue and it appears that their standalone SDK (v1.0.12) has the expected behavior. Crisp suggested to open an issue here :) FYI, their sdk dynamically loads the language configuration from your crisp account setting and uses the right locale. So there is no point for them of exposing a "locale" property for a setLocale in your lib.

Hope this helps!

FRizzonelli commented 3 years ago

@Yhnlvy Mmm that seems to doesn't work. I've tested with iOS simulator: Either I choose italian or english, chat sdk ui is always in English. Also the user is identified as "english" user, on the web sdk the parameter is exposed, I'd like to have the same here!

Yhnlvy commented 3 years ago

Hi @walterholohan ! Hope you're doing well :) Did you have the chance to further investigate our issue? Thanks!

Elpayet commented 3 years ago

Hello, I am also interested in this feature. That would be great.

walterholohan commented 3 years ago

Hey @Elpayet @Yhnlvy ill try to take a look at it over the next few days. Im fairly busy at the moment with a new baby just arriving in the family, but will try squeeze some time out to investigate this issue.

walterholohan commented 3 years ago

Hey @Elpayet @Yhnlvy did you try this on a real device? Ive just been trying to debug on a simulator and it seems that the locale of the simulator always returns en_US. Can you add the below line to your appDelegate and see what locale it returns for your device. This will help to debug this issue easier.

 NSLog(@"localeIdentifier: %@", [[NSLocale currentLocale] localeIdentifier]);
Elpayet commented 2 years ago

@walterholohan here is my locale on my real device :

Capture d’écran 2021-12-03 à 16 10 51

ElpayetSupervan commented 2 years ago

@walterholohan I've contacted Crisp. They propose this change (without any instruction or any clue to where this is going). Does it ring any bell to you ? image

ElpayetSupervan commented 2 years ago

I was not be able to run the projet and test it, depsite my attempts following the readme.

runna-app commented 2 years ago

In AppDelegate.m in your project can you try do something like:

[CrispSDK configureWithWebsiteID:@"YOUR_WEBSITE_ID"];
NSLocale *frLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"fr-fr"];
[CrispSDK setLocale:frLocale];

My obj-c is very rusty so it might not work

Elpayet commented 2 years ago

@therunbuddy thanks for your suggestion, unfortunately, no matter what variation of 'fr-fr' (fr_FR, fr, FR, etc...) I use, it still is in english.

@walterholohan @Yhnlvy reverting back to default initialization of Crisp, I managed to change my current locale to fr_FR, using a dummy Localizable.string file and adding support for French language in Xcode project setting. You were right @walterholohan : the locale auto detection works, the only condition is to make sure your currentLocal is properly set, as I describe. Maybe this could be a good tip to add in this repo documentation.

Elpayet commented 2 years ago

Here is the result :

IMG_268C9EAB5595-1

Now it coud be interesting to override this behavior from RN based on user in-app preferences, or hard-coded arbitrary decision. what do you think ?

walterholohan commented 2 years ago

@Elpayet thank you for solving this issue. Would you be able to raise a PR with the suggested changes to README? I will review and then release a new version.

Elpayet commented 2 years ago

@walterholohan please check https://github.com/walterholohan/react-native-crisp-chat-sdk/pull/50. Thanks for your help.