stripe-ios
stripe-ios copied to clipboard
Changing localisation in app
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
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.
Hi @davidme-stripe, do you know if there's work in progress to making STPLocalizationUtil
public?
@davidme-stripe any news on the above please?
Hi @davidme-stripe @yuki-stripe do you know if there is any progress on exposing an interface for STPLocalizationUtil to clients?
Hi! Is there any way of overriding the SDK language? Thanks.