Description
Strings in dropin are translated partially.
When shopperLocale is set to:
- "pl_PL" - strings are translated partially (mix of pl and eng) - see attached screenshots with "pl_PL" suffix
- "pl-PL" - strings are translated correctly - see attached screenshots with "pl-PL" suffix.
Backend uses sessions integration flow.
Backend set shopperLocale to "pl_PL".
Android app receives CheckoutSession with SessionSetupResponse.shopperLocale set to "pl_PL".
Since strings in dropin are partially translated, I believe there are multiple call sites and methods that try to obtain locale and this flow isn't bulletproof.
Expected behavior (possible solutions):
- Unify / fix flow of obtaining locale
- Handle both formats (with "_" and "-") of
shopperLocale properly or inform about invalid format
- Consistent translation
Steps to Reproduce
- I am able to consistently reproduce this issue: Yes
- Steps to reproduce the issue:
- Get
CheckoutSession from SessionSetupResponse.createSession()
- Create copy of returned
CheckoutSession from step i with overwritten SessionSetupResponse.shopperLocale ("pl_PL")
- Start payment:
DropIn.startPayment(
dropInLauncher = dropInLauncher,
checkoutSession = checkoutSession,
)
- Screenshots:
"pl_PL" (check Blik z kodem and Karta bankowa):
"pl-PL":
Code Snippets
Maybe this will be helpful:
during debugging I found that those methods weren't using / returning correct locale:
checkout-core:5.6.0
LocaleUtil
fun fromLanguageTag(tag: String): Locale {
return Locale.forLanguageTag(tag)
}
checkout-core:5.6.0
LocaleProvider
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
class LocaleProvider {
fun getLocale(context: Context): Locale {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
context.resources.configuration.locales[0]
} else {
@Suppress("DEPRECATION")
context.resources.configuration.locale
}
}
}
components-core:5.6.0
ContextExtensions:
fun Context.createLocalizedContext(locale: Locale): Context {
val configuration = resources.configuration
val newConfig = Configuration(configuration)
newConfig.setLocale(locale)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
val localeList = LocaleList(locale)
LocaleList.setDefault(localeList)
newConfig.setLocales(localeList)
}
return createConfigurationContext(newConfig) ?: this
}
Integration Information
- Server-side integration: Sessions
- Client-side integration: Drop-in
- SDK version: 5.6.0
- Android version(s) where issue occurs: API 34
- Device model(s) where issue occurs: emulator - pixel 5, google play services, API 34, arm64. System language: polish (default), english (US).
Additional Context
Related issues:
Adyen/adyen-react-native#15
#1558
#680
Keywords: localization, translations, language, resources
Description
Strings in dropin are translated partially.
When
shopperLocaleis set to:Backend uses
sessionsintegration flow.Backend set
shopperLocaleto "pl_PL".Android app receives
CheckoutSessionwithSessionSetupResponse.shopperLocaleset to"pl_PL".Since strings in dropin are partially translated, I believe there are multiple call sites and methods that try to obtain locale and this flow isn't bulletproof.
Expected behavior (possible solutions):
shopperLocaleproperly or inform about invalid formatSteps to Reproduce
CheckoutSessionfromSessionSetupResponse.createSession()CheckoutSessionfrom stepiwith overwrittenSessionSetupResponse.shopperLocale("pl_PL")"pl_PL" (check
Blik z kodemandKarta bankowa):"pl-PL":
Code Snippets
Maybe this will be helpful:
during debugging I found that those methods weren't using / returning correct locale:
Integration Information
Additional Context
Related issues:
Adyen/adyen-react-native#15
#1558
#680
Keywords: localization, translations, language, resources