Merged in fix/SW-3021-vouchers (pull request #2719)
fix(SW-3021): add pluralization support for vouchers * fix(SW-3021): add pluralization support for vouchers Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -338,15 +338,25 @@ function VoucherCode({
|
||||
|
||||
const rateTermDetails = getRateTermDetails(codeProduct)
|
||||
|
||||
const voucherMsg = intl
|
||||
.formatMessage({
|
||||
defaultMessage: "Voucher",
|
||||
})
|
||||
.toUpperCase()
|
||||
let price = `${numberOfVouchers} ${voucherMsg}`
|
||||
if (packagesSum.price) {
|
||||
price = `${price} + ${packagesSum.price}`
|
||||
}
|
||||
const voucherMsg = intl.formatMessage(
|
||||
{
|
||||
defaultMessage:
|
||||
"{numberOfVouchers, plural, one {Voucher} other {Vouchers}}",
|
||||
},
|
||||
{
|
||||
numberOfVouchers: numberOfVouchers,
|
||||
}
|
||||
)
|
||||
|
||||
const { price, currency } = packagesSum.price
|
||||
? {
|
||||
price: `${numberOfVouchers} ${voucherMsg} + ${packagesSum.price}`,
|
||||
currency: packagesSum.currency ?? "",
|
||||
}
|
||||
: {
|
||||
price: `${numberOfVouchers} ${voucherMsg}`,
|
||||
currency: "",
|
||||
}
|
||||
return (
|
||||
<CodeRateCard
|
||||
key={codeProduct.rate}
|
||||
@@ -358,7 +368,7 @@ function VoucherCode({
|
||||
rate={{
|
||||
label: codeProduct.rateDefinition?.title,
|
||||
price,
|
||||
unit: packagesSum.currency ?? "",
|
||||
unit: currency,
|
||||
}}
|
||||
rateTitle={rateTitles[codeProduct.rate].title}
|
||||
rateTermDetails={rateTermDetails}
|
||||
|
||||
Reference in New Issue
Block a user