stripe / stripe-ios

Stripe iOS SDK
https://stripe.com
MIT License
2.12k stars 982 forks source link

Changing localisation in app #1763

Open joshua-mf opened 3 years ago

joshua-mf commented 3 years ago

Summary

Our app currently allows users to change languages without killing/restarting the app. The SDK doesn't automatically handle this scenario from the looks of it. So any error that is thrown from Confirming Payment is always in the previous language.

After taking a look through the SDK codebase and changing the access modifier for STPLocalizationUtils and calling STPLocalizationUtils.overrideLanguage(to: languageCode), the SDK language changes for local errors as expected and all errors are localised to the selected language. But not for server error messages

This seems to happen if the PaymentIntent requires authentication(CVC re-collection in my case), then declines. I get the error localizedDescription not localised.

Is there another way of overriding the SDK language? Any help would be appreciated. Thanks

iOS version

14.4

Installation method

Cocopods

SDK version

21.2.1

Other information

davidme-stripe commented 3 years ago

Hi @joshua-mf, thanks for filing this! We're open to making STPLocalizationUtils.overrideLanguage public in a future update, though I need to dig into the details and make sure we aren't missing any edge cases. For now, you should be able to interpret the error codes to return your own error messages, though I realize that isn't optimal.

ghost commented 3 years ago

Hi @davidme-stripe, do you know if there's work in progress to making STPLocalizationUtil public?

joshua-mf commented 3 years ago

@davidme-stripe any news on the above please?

ghost commented 3 years ago

Hi @davidme-stripe @yuki-stripe do you know if there is any progress on exposing an interface for STPLocalizationUtil to clients?

dibelogrivaya commented 9 months ago

Hi! Is there any way of overriding the SDK language? Thanks.