fix(i18n): prepare for Lokalise
This commit is contained in:
@@ -137,6 +137,38 @@ function Trigger({
|
||||
}) {
|
||||
const intl = useIntl()
|
||||
|
||||
const parts = []
|
||||
|
||||
parts.push(
|
||||
intl.formatMessage(
|
||||
{ id: "{totalRooms, plural, one {# room} other {# rooms}}" },
|
||||
{ totalRooms: rooms.length }
|
||||
)
|
||||
)
|
||||
|
||||
parts.push(
|
||||
intl.formatMessage(
|
||||
{ id: "{totalAdults, plural, one {# adult} other {# adults}}" },
|
||||
{ totalAdults: rooms.reduce((acc, room) => acc + room.adults, 0) }
|
||||
)
|
||||
)
|
||||
|
||||
if (rooms.some((room) => room.child.length > 0)) {
|
||||
parts.push(
|
||||
intl.formatMessage(
|
||||
{
|
||||
id: "{totalChildren, plural, one {# child} other {# children}}",
|
||||
},
|
||||
{
|
||||
totalChildren: rooms.reduce(
|
||||
(acc, room) => acc + room.child.length,
|
||||
0
|
||||
),
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Button
|
||||
className={`${className} ${styles.btn}`}
|
||||
@@ -144,29 +176,7 @@ function Trigger({
|
||||
onPress={triggerFn}
|
||||
>
|
||||
<Body color="uiTextHighContrast">
|
||||
<span>
|
||||
{intl.formatMessage(
|
||||
{ id: "booking.rooms" },
|
||||
{ totalRooms: rooms.length }
|
||||
)}
|
||||
{", "}
|
||||
{intl.formatMessage(
|
||||
{ id: "booking.adults" },
|
||||
{ totalAdults: rooms.reduce((acc, room) => acc + room.adults, 0) }
|
||||
)}
|
||||
{rooms.some((room) => room.child.length > 0)
|
||||
? ", " +
|
||||
intl.formatMessage(
|
||||
{ id: "booking.children" },
|
||||
{
|
||||
totalChildren: rooms.reduce(
|
||||
(acc, room) => acc + room.child.length,
|
||||
0
|
||||
),
|
||||
}
|
||||
)
|
||||
: null}
|
||||
</span>
|
||||
<span>{parts.join(", ")}</span>
|
||||
</Body>
|
||||
</Button>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user