fix(i18n): prepare for Lokalise
This commit is contained in:
@@ -10,23 +10,21 @@ export default function LevelSummary({
|
||||
}: LevelSummaryProps) {
|
||||
const intl = useIntl()
|
||||
|
||||
let pointsMsg: React.ReactNode = intl.formatMessage(
|
||||
{ id: "{pointsAmount, number} points" },
|
||||
{ pointsAmount: level.required_points }
|
||||
)
|
||||
|
||||
if (level.required_nights) {
|
||||
pointsMsg = intl.formatMessage<React.ReactNode>(
|
||||
{
|
||||
id: "{pointsAmount, number} points or {nightsAmount, number} nights",
|
||||
},
|
||||
{
|
||||
pointsAmount: level.required_points,
|
||||
nightsAmount: level.required_nights,
|
||||
highlight: (str) => <span className={styles.redText}>{str}</span>,
|
||||
}
|
||||
)
|
||||
}
|
||||
const pointsMsg: React.ReactNode = level.required_nights
|
||||
? intl.formatMessage<React.ReactNode>(
|
||||
{
|
||||
id: "{pointsAmount, number} points or {nightsAmount, number} nights",
|
||||
},
|
||||
{
|
||||
pointsAmount: level.required_points,
|
||||
nightsAmount: level.required_nights,
|
||||
highlight: (str) => <span className={styles.redText}>{str}</span>,
|
||||
}
|
||||
)
|
||||
: intl.formatMessage(
|
||||
{ id: "{pointsAmount, number} points" },
|
||||
{ pointsAmount: level.required_points }
|
||||
)
|
||||
|
||||
return (
|
||||
<div className={styles.levelSummary}>
|
||||
|
||||
@@ -57,7 +57,7 @@ export default function StayCard({ stay }: StayCardProps) {
|
||||
<Caption asChild>
|
||||
<time dateTime={arrivalDateTime}>{arrivalDate}</time>
|
||||
</Caption>
|
||||
{intl.formatMessage({ id: " - " })}
|
||||
{" - "}
|
||||
<Caption asChild>
|
||||
<time dateTime={departDateTime}>{departDate}</time>
|
||||
</Caption>
|
||||
|
||||
@@ -51,7 +51,7 @@ export default async function HotelListingItem({
|
||||
</div>
|
||||
<Caption color="uiTextPlaceholder">
|
||||
{intl.formatMessage(
|
||||
{ id: "{number} km to city centre" },
|
||||
{ id: "{number} km to city center" },
|
||||
{
|
||||
number: getSingleDecimal(
|
||||
hotel.location.distanceToCentre / 1000
|
||||
|
||||
@@ -25,7 +25,7 @@ export default async function IntroSection({
|
||||
const { streetAddress, city } = address
|
||||
const { distanceToCentre } = location
|
||||
const formattedDistanceText = intl.formatMessage(
|
||||
{ id: "{number} km to city centre" },
|
||||
{ id: "{number} km to city center" },
|
||||
{ number: getSingleDecimal(distanceToCentre / 1000) }
|
||||
)
|
||||
const lang = getLang()
|
||||
|
||||
@@ -54,7 +54,7 @@ export async function getSeatingText(roomSeating: number[]) {
|
||||
if (biggestSeating === smallestSeating) {
|
||||
seatingText = intl.formatMessage(
|
||||
{ id: "{value} persons" },
|
||||
{ number: biggestSeating }
|
||||
{ value: biggestSeating }
|
||||
)
|
||||
} else if (smallestSeating != null && biggestSeating) {
|
||||
{
|
||||
|
||||
@@ -138,21 +138,16 @@ function Trigger({
|
||||
}) {
|
||||
const intl = useIntl()
|
||||
|
||||
const parts = []
|
||||
|
||||
parts.push(
|
||||
const parts = [
|
||||
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.childrenInRoom.length > 0)) {
|
||||
parts.push(
|
||||
|
||||
@@ -160,7 +160,7 @@ export default function Receipt({
|
||||
{intl.formatMessage(
|
||||
{ id: "Approx. {value}" },
|
||||
{
|
||||
value: "N/A EUR",
|
||||
value: "N/A",
|
||||
}
|
||||
)}
|
||||
</Caption>
|
||||
|
||||
@@ -38,7 +38,7 @@ export default async function HotelHeader({ hotelData }: HotelHeaderProps) {
|
||||
<Caption color="white">∙</Caption>
|
||||
<Caption color="white">
|
||||
{intl.formatMessage(
|
||||
{ id: "{number} km to city centre" },
|
||||
{ id: "{number} km to city center" },
|
||||
{
|
||||
number: getSingleDecimal(
|
||||
hotel.location.distanceToCentre / 1000
|
||||
|
||||
@@ -122,7 +122,7 @@ function HotelCard({
|
||||
</div>
|
||||
<Caption color="uiTextPlaceholder">
|
||||
{intl.formatMessage(
|
||||
{ id: "{number} km to city centre" },
|
||||
{ id: "{number} km to city center" },
|
||||
{
|
||||
number: getSingleDecimal(
|
||||
hotelData.location.distanceToCentre / 1000
|
||||
|
||||
@@ -48,7 +48,7 @@ export default function FilterAndSortModal({
|
||||
|
||||
const sortItems: SortItem[] = [
|
||||
{
|
||||
label: intl.formatMessage({ id: "Distance to city centre" }),
|
||||
label: intl.formatMessage({ id: "Distance to city center" }),
|
||||
value: SortOrder.Distance,
|
||||
},
|
||||
{ label: intl.formatMessage({ id: "Name" }), value: SortOrder.Name },
|
||||
|
||||
@@ -39,7 +39,7 @@ export default function HotelSorter({ discreet }: HotelSorterProps) {
|
||||
)
|
||||
const sortItems: SortItem[] = [
|
||||
{
|
||||
label: intl.formatMessage({ id: "Distance to city centre" }),
|
||||
label: intl.formatMessage({ id: "Distance to city center" }),
|
||||
value: SortOrder.Distance,
|
||||
},
|
||||
{ label: intl.formatMessage({ id: "Name" }), value: SortOrder.Name },
|
||||
|
||||
@@ -72,12 +72,12 @@ export default async function HotelInfoCard({
|
||||
<Caption color="uiTextMediumContrast">
|
||||
{intl.formatMessage(
|
||||
{
|
||||
id: "{address}, {city} ∙ {distanceToCityCentreInKm} km to city center",
|
||||
id: "{address}, {city} ∙ {distanceToCityCenterInKm} km to city center",
|
||||
},
|
||||
{
|
||||
address: hotelAttributes.address.streetAddress,
|
||||
city: hotelAttributes.address.city,
|
||||
distanceToCityCentreInKm: getSingleDecimal(
|
||||
distanceToCityCenterInKm: getSingleDecimal(
|
||||
hotelAttributes.location.distanceToCentre / 1000
|
||||
),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user