Adyen / adyen-flutter

MIT License
23 stars 4 forks source link

[NEED ASSIST] Force locale #152

Closed alna26 closed 4 months ago

alna26 commented 4 months ago

Could you please tell how to force locale, I'm using sessions flow and drop-in. After adding shopperLocale in DropInConfiguration, it still picks-up device's setting locale on iOS (somehow adding cardConfiguration: const CardConfiguration() in DropInConfiguration fixed the issue, but when trying to customize the texts it shows the default translations) .

final dropInConfiguration = DropInConfiguration( environment: configuration.environment, clientKey: configuration.clientKey, countryCode: configuration.countryCode, shopperLocale: configuration.shopperLocale, amount: configuration.amount, cardConfiguration: const CardConfiguration(), applePayConfiguration: ApplePayConfiguration( merchantId: applePayMerchantId, merchantName: applePayMerchantName, allowOnboarding: true, ), )

Robert-SD commented 4 months ago

Hello @alna26, I would like to help you. Could you quickly describe how you customize the texts?

Robert-SD commented 4 months ago

Hi @alna26, I just want to follow up on your question. Do you need further assistance?

Robert-SD commented 4 months ago

Hi @alna26, we would like to close this issue but in case you still need support, please feel free to reopen it.

matmicro commented 2 months ago

Hi,

I am facing same issue. I am using shopperLocal set to "fr_FR" but the widget is always displayed in english. Could you please let me know how to force the language ?

Regards

Robert-SD commented 2 months ago

Hi @matmicro, I assume you are using the sessions flow? In that case, could you provide a value for shopperLocale e.g. "fr-FR" when using our /sessions endpoint? In addition, could you set the shopperLocale value inside the DropInConfiguration also to "fr-FR"? That should change the language to French.

matmicro commented 2 months ago

Thanks for your help. I was using :

DropInConfiguration(
        shopperLocale: Get.locale!.toStringWithSeparator(),

which is by default fr_FR and which does not works.

Solution that works is:

DropInConfiguration(
        shopperLocale: Get.locale!.toStringWithSeparator(separator: '-'),

then with value fr-FR it works fine !

Thanks and regards

matmicro commented 2 months ago

Apologies but this works only on Android. The widget is still in a mixed language on iOS. It's displayed a mix of "Pay", "Change payment methods" and "Carte bancaire" when trying to set locale "fr" or "fr-FR".

@Robert-SD Are you able to reproduce it ?

Robert-SD commented 2 months ago

Hello @matmicro,

sure, I will try to reproduce it so we can solve it together. In order to pin down the problem, I would like to clarify the flow you are using. Is it the sessions flow

final PaymentResult paymentResult = await AdyenCheckout.session.startDropIn(
        dropInConfiguration: dropInConfiguration,
        checkout: sessionCheckout,
);

or the advanced flow?

final PaymentResult paymentResult = await AdyenCheckout.advanced.startDropIn(
       dropInConfiguration: dropInConfiguration,
       paymentMethods: paymentMethodsResponse,
       checkout: advancedCheckout,
);

In case of the the sessions flow, could you check the shopperLocale value you send when fetching a session via our /sessions API? Do you send "fr-FR" there as well? You need to send this value in order to specify the language of the payment method list because it is part of the session itself. The session language cannot be adjusted later. It is therefore necessary to provide the shopperLocale in both: the sessions request and the dropInConfiguration.

This is the result of the example. Is this your expected behavior?

Payment method list Card payment
matmicro commented 2 months ago

Hi @Robert-SD

I am using AdyenCheckout.session.startDropIn(...) Indeed the shopperLocale was not properly set on backend call to session. I fixed it but it looks it does not resolve the issue on iOS unfortunately. I will check how it goes with advanced flow.

matmicro commented 2 months ago

Hi @Robert-SD Yes your screenshot is the expected behavior. I am sending "fr-FR" in the session (python code) adyen.checkout.payments_api.sessions('shopperLocale': 'fr-FR', ...) and also in the DropInConfiguration.

But i got mixed languages: "Change payment methods" (EN) and "Carte bancaire" (FR).

matmicro commented 1 month ago

Hi @Robert-SD I am able to get is working properly on Android emulator. But once built, it is still a mixed languages on a real Android device... This looks weird, any idea of a potential root cause ?