stripe-ios icon indicating copy to clipboard operation
stripe-ios copied to clipboard

Changing localisation in app

Open joshua-mf opened this issue 3 years ago • 5 comments

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

joshua-mf avatar Feb 19 '21 12:02 joshua-mf

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.

  • To solve the issue you're referring to, we'll need to send the correct language to the Stripe API in the Accept-Language header.
  • We'll also need to support passing the specified language to Stripe3DS2, to ensure 3DS2-related messages are localized properly.

davidme-stripe avatar Feb 22 '21 22:02 davidme-stripe

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

ghost avatar Mar 15 '21 12:03 ghost

@davidme-stripe any news on the above please?

joshua-mf avatar Mar 24 '21 10:03 joshua-mf

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

ghost avatar Apr 09 '21 09:04 ghost

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

dibelogrivaya avatar Jan 29 '24 17:01 dibelogrivaya