fix(i18n): prepare for Lokalise
This commit is contained in:
@@ -33,13 +33,13 @@ export default function GuestsRoomsPickerDialog({
|
||||
const { getFieldState, trigger, setValue } =
|
||||
useFormContext<BookingWidgetSchema>()
|
||||
const roomsValue = useWatch<BookingWidgetSchema, "rooms">({ name: "rooms" })
|
||||
const addRoomLabel = intl.formatMessage({ id: "Add Room" })
|
||||
const addRoomLabel = intl.formatMessage({ id: "Add room" })
|
||||
const doneLabel = intl.formatMessage({ id: "Done" })
|
||||
const disabledBookingOptionsHeader = intl.formatMessage({
|
||||
id: "Disabled booking options header",
|
||||
id: "We're sorry",
|
||||
})
|
||||
const disabledBookingOptionsText = intl.formatMessage({
|
||||
id: "Disabled adding room",
|
||||
id: "Adding room is not available on the new website yet.",
|
||||
})
|
||||
|
||||
const handleClose = useCallback(async () => {
|
||||
|
||||
@@ -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