Skip to content

Commit

Permalink
Parameterize string
Browse files Browse the repository at this point in the history
  • Loading branch information
porter-stripe committed Jan 24, 2025
1 parent a4ebd98 commit 6c9b10c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion payments-ui-core/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@
<!-- Label for UPI ID number field on form -->
<string name="stripe_upi_id_label">UPI ID</string>
<!-- Shown in a dropdown picker next to a card brand that is not accepted by a merchant. E.g. "Visa (not accepted)" -->
<string name="stripe_card_brand_not_accepted">(not accepted)</string>
<string name="stripe_card_brand_not_accepted_with_brand">%1$s (not accepted)</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,10 @@ internal class DefaultCardNumberController(
label = if (enabled) {
brand.displayName.resolvableString
} else {
brand.displayName.resolvableString +
" ".resolvableString +
resolvableString(R.string.stripe_card_brand_not_accepted)
resolvableString(
R.string.stripe_card_brand_not_accepted_with_brand,
brand.displayName
)
},
icon = brand.icon,
enabled = enabled
Expand Down
2 changes: 0 additions & 2 deletions paymentsheet/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,4 @@
<!-- A text notice shown when the user selects an expired card. -->
<string name="stripe_wallet_update_expired_card_error">This card has expired. Update your card info or choose a different payment method.</string>
<string name="stripe_wallet_expand_accessibility">Change selection</string>
<!-- Shown in a dropdown picker next to a card brand that is not accepted by a merchant. E.g. "Visa (not accepted)" -->
<string name="stripe_card_brand_not_accepted">(not accepted)</string>
</resources>
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.stripe.android.paymentsheet.ui

import com.stripe.android.core.strings.ResolvableString
import com.stripe.android.core.strings.plus
import com.stripe.android.core.strings.resolvableString
import com.stripe.android.model.CardBrand
import com.stripe.android.paymentsheet.R
import com.stripe.android.ui.core.R
import com.stripe.android.uicore.elements.SingleChoiceDropdownItem

internal data class CardBrandChoice(
Expand All @@ -19,9 +18,9 @@ internal data class CardBrandChoice(
get() = if (enabled) {
brand.displayName.resolvableString
} else {
// If it's disabled, append "not accepted" to the end of the brand display name
brand.displayName.resolvableString +
" ".resolvableString +
resolvableString(R.string.stripe_card_brand_not_accepted)
resolvableString(
R.string.stripe_card_brand_not_accepted_with_brand,
brand.displayName
)
}
}

0 comments on commit 6c9b10c

Please sign in to comment.