stripe-react-native icon indicating copy to clipboard operation
stripe-react-native copied to clipboard

[Payment sheet] Localization support

Open fedebaier opened this issue 3 years ago • 28 comments

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 avatar May 20 '21 10:05 fedebaier

@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.

thorsten-stripe avatar May 24 '21 09:05 thorsten-stripe

I've tested changing the device's language but it always shows in English.

fedebaier avatar May 25 '21 12:05 fedebaier

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?

thorsten-stripe avatar May 26 '21 15:05 thorsten-stripe

Yes, I've tried this in both iOS and Android, on simulators and on physical devices, and it always displays in English.

fedebaier avatar May 26 '21 16:05 fedebaier

@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 image

  • iOS image

thorsten-stripe avatar May 27 '21 14:05 thorsten-stripe

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:

Screenshot 2021-05-27 at 17 20 46

Simulator Screen Shot - iPhone 11 Pro Max - 2021-05-27 at 17 18 51

Simulator Screen Shot - iPhone 11 Pro Max - 2021-05-27 at 17 19 16

fedebaier avatar May 27 '21 15:05 fedebaier

Same here, after adding Spanish through Xcode and building. The issue seems to persist in iOS.

harbolaez avatar Jun 12 '21 15:06 harbolaez

fixed mine, by adding to info.plist:

<key>CFBundleAllowMixedLocalizations</key>
<string>true</string>
<key>CFBundleLocalizations</key>
<array>
    <string>en</string>
    <string>es</string>
</array>

harbolaez avatar Jun 12 '21 17:06 harbolaez

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.

fedebaier avatar Jun 12 '21 20:06 fedebaier

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.

SlavisDEV avatar Nov 11 '21 19:11 SlavisDEV

@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 avatar Nov 12 '21 22:11 nmehlei

@nmehlei Have you found a solution yet? We also want to support to change locale of the payment form.

angelorobo avatar Jan 02 '22 09:01 angelorobo

+1 This is an enhancement we are waiting for~ Or can we use Stripe customer object's preferred_locales instead?

cyim02 avatar Mar 14 '22 03:03 cyim02

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 avatar Mar 18 '22 20:03 charliecruzan-stripe

@charliecruzan-stripe Do you mean we programmatically change the app locale in the native side of the app?

cyim02 avatar Mar 21 '22 09:03 cyim02

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)

charliecruzan-stripe avatar Mar 21 '22 13:03 charliecruzan-stripe

@thorsten-stripe I want to change the payment sheet language with InApp locale for Andoid. Is there a way to do it? 241e6744-12fd-448a-9455-f5df888aa388

AbdullahJaved-dev avatar Nov 22 '22 14:11 AbdullahJaved-dev

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?

charliecruzan-stripe avatar Nov 22 '22 18:11 charliecruzan-stripe

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.

AbdullahJaved-dev avatar Nov 23 '22 08:11 AbdullahJaved-dev

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 🧐

DavitVosk avatar Dec 21 '22 12:12 DavitVosk

The language option should be at top level, not only the payment sheet, in order to localize also error messages.

angelica-snowit avatar Dec 29 '22 14:12 angelica-snowit

Same here. Our app use multiple languages and the payment sheet should be localized in one of them dinamically.

cufano avatar Feb 06 '23 16:02 cufano

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!

d4n1b avatar Apr 06 '23 13:04 d4n1b

I created payment sheet with custom string to solve this issue. https://github.com/kothihaaung/stripe-paymentsheet-customlabel

screenshot_myanmar

kothihaaung avatar Dec 12 '23 08:12 kothihaaung

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 avatar Jan 01 '24 20:01 ahmadkhalaf1

@ahmadkhalaf1 did you find any solution for your specific case ? Im facing the same issue

ArnaudFeelbat avatar Jan 11 '24 12:01 ArnaudFeelbat

Anyone working on this?

aliwaqar981 avatar Mar 14 '24 11:03 aliwaqar981