fix(i18n): prepare for Lokalise

This commit is contained in:
Michael Zetterberg
2025-01-03 14:54:46 +01:00
parent cbc17e2c5b
commit d2ce9c0d7c
120 changed files with 1703 additions and 1042 deletions

View File

@@ -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>
)