diff --git a/src/funding/common.jsx b/src/funding/common.jsx index 65295057a..2114a2daa 100644 --- a/src/funding/common.jsx +++ b/src/funding/common.jsx @@ -144,6 +144,7 @@ export type FundingSourceConfig = {| fundingEligibility: ?FundingEligibilityType, label?: string, period?: number, + locale?: LocaleType, |}) => string), showWalletMenu: ({| instrument: WalletInstrument, diff --git a/src/funding/paylater/config.jsx b/src/funding/paylater/config.jsx index a3112b302..da36efc53 100644 --- a/src/funding/paylater/config.jsx +++ b/src/funding/paylater/config.jsx @@ -2,7 +2,7 @@ /** @jsx node */ import type { FundingEligibilityType } from "@paypal/sdk-client/src"; -import { FUNDING } from "@paypal/sdk-constants/src"; +import { FUNDING, type LocaleType } from "@paypal/sdk-constants/src"; import { node, Style } from "@krakenjs/jsx-pragmatic/src"; import { PPLogoExternalImage, @@ -21,9 +21,11 @@ import css from "./style.scoped.scss"; function getLabelText( fundingEligibility: FundingEligibilityType, + locale?: LocaleType, shouldApplyRebrandedStyles?: boolean ): ?string { const { paylater } = fundingEligibility; + const { lang } = locale || {}; let labelText; @@ -48,6 +50,14 @@ function getLabelText( labelText = "Paga in 3 rate"; } + if ( + paylater?.products?.paylater?.eligible && + paylater?.products?.paylater?.variant === "CA" && + lang === "fr" + ) { + labelText = "Payer en 4"; + } + if (paylater?.products?.payIn4?.eligible) { labelText = "Pay in 4"; } @@ -99,7 +109,9 @@ export function getPaylaterConfig(): FundingSourceConfig { ) : ( )} - {getLabelText(fundingEligibility) || "Pay Later"} + + {getLabelText(fundingEligibility, locale) || "Pay Later"} + ); } @@ -120,8 +132,11 @@ export function getPaylaterConfig(): FundingSourceConfig { )} - {getLabelText(fundingEligibility, shouldApplyRebrandedStyles) || - "Pay Later"} + {getLabelText( + fundingEligibility, + locale, + shouldApplyRebrandedStyles + ) || "Pay Later"} ); @@ -167,9 +182,9 @@ export function getPaylaterConfig(): FundingSourceConfig { [BUTTON_COLOR.REBRAND_BLACK]: LOGO_COLOR.WHITE, }, - labelText: ({ fundingEligibility }) => { + labelText: ({ fundingEligibility, locale }) => { return ( - (fundingEligibility && getLabelText(fundingEligibility)) || + (fundingEligibility && getLabelText(fundingEligibility, locale)) || `${FUNDING.PAYPAL} ${FUNDING.PAYLATER}` ); }, diff --git a/src/ui/buttons/button.jsx b/src/ui/buttons/button.jsx index a1cd9bcb4..e0ba42db3 100644 --- a/src/ui/buttons/button.jsx +++ b/src/ui/buttons/button.jsx @@ -185,6 +185,7 @@ export function Button({ fundingEligibility, label: eligibleLabel, period, + locale, }) : fundingConfig.labelText || fundingSource;