stripe-react-native
stripe-react-native copied to clipboard
[Payment sheet] Localization support
I'm implementing the Pre-built payments UI and couldn't find a way to set a locale to show it in different languages. Is there something I'm missing or is this not yet implemented?
It's quite important for our app, since it supports a few languages.
@fedebaier thanks for the feedback! Currently the sheet is localised based on the language in the phone device settings. But I agree that we should allow you to overwrite it. I've forwarded this to the team.
I've tested changing the device's language but it always shows in English.
If you go to Settings -> System -> Languages & Input -> Languages -> and then add your language to the top of the list, you should see a different version when you go back to the payment sheet.
@fedebaier have you tested both platforms?
Yes, I've tried this in both iOS and Android, on simulators and on physical devices, and it always displays in English.
@fedebaier which languages have you set for your apps? It's working fine for me. Do note that on iOS you need to specify which languages your app supports: https://help.apple.com/xcode/mac/current/#/devafa3a605f on Android that isn't required.
-
Android
-
iOS
It's working now on Android (maybe I didn't test properly there), but the issue persists on iOS, even after specifying the languages like you suggested:

Same here, after adding Spanish through Xcode and building. The issue seems to persist in iOS.
fixed mine, by adding to info.plist:
<key>CFBundleAllowMixedLocalizations</key>
<string>true</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>es</string>
</array>
fixed mine, by adding to info.plist:
<key>CFBundleAllowMixedLocalizations</key> <string>true</string> <key>CFBundleLocalizations</key> <array> <string>en</string> <string>es</string> </array>
That solved the issue also for me, thanks! Still would be nice to have the option to pass a locale to the payment sheet.
fixed mine, by adding to info.plist:
<key>CFBundleAllowMixedLocalizations</key> <string>true</string> <key>CFBundleLocalizations</key> <array> <string>en</string> <string>es</string> </array>
This does not work for me. Anyone has similiar issue? I tried to set language directly inside Info.plist and by Xcode -> General as well.
@thorsten-stripe Is it planned to support an override for the language? If yes, is there an estimation when this will become available? In my case, the app I'm developing should display in a different language than my device's language.
@nmehlei Have you found a solution yet? We also want to support to change locale of the payment form.
+1 This is an enhancement we are waiting for~ Or can we use Stripe customer object's preferred_locales instead?
Does editing info.plist not work for folks that are commenting here? You should be able to programmatically change the app locale, which would be a good solution for @nmehlei's issue (I think)
<key>CFBundleAllowMixedLocalizations</key>
<string>true</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>es</string>
</array>
@charliecruzan-stripe Do you mean we programmatically change the app locale in the native side of the app?
Yes, I'm pretty sure there are methods to do that on both iOS and Android (although it may take some digging, and I'm not sure if it's generally recommended to override the user's locale)
@thorsten-stripe I want to change the payment sheet language with InApp locale for Andoid. Is there a way to do it?
The payment sheet localizes itself to use the device's current language settings. What's the use case for overriding the user's own language setting?
The payment sheet localizes itself to use the device's current language settings. What's the use case for overriding the user's own language setting?
With device language change payment sheet works fine. But I want to change app language without changing device language. In this scenario payment sheet is not translated.
Do we have any progress for this please @charliecruzan-stripe @thorsten-stripe? Our app is supporting different languages and we would like the payment sheet to be localized in the same language as our app, but it listens to device language only 🧐
The language option should be at top level, not only the payment sheet, in order to localize also error messages.
Same here. Our app use multiple languages and the payment sheet should be localized in one of them dinamically.
Hi everyone, is there any update on this? - as @angelica-snowit mentioned, even though the Payment Sheet is showing the right language depending on the OS settings, I can still see the localizedMessage
errors in English, i.e.:
{
"stripeErrorCode": null,
"declineCode": null,
"localizedMessage": "The payment has been canceled", <- HERE
"message": "The payment has been canceled",
"type": null,
"code": "Canceled"
}
We are trying at least to provide our own translation to those messages, but unsure if it's safe to rely on the code
: "Canceled".
Thanks!
I created payment sheet with custom string to solve this issue. https://github.com/kothihaaung/stripe-paymentsheet-customlabel
what is the current status of this? i would like to change the language without changing the phone language , also react native 0.73 and android 14 , language change wont change the payment sheet for me.
@ahmadkhalaf1 did you find any solution for your specific case ? Im facing the same issue
Anyone working on this?