feat: SW-276 Updated plurals for labels

This commit is contained in:
Hrishikesh Vaipurkar
2024-10-07 15:32:23 +02:00
parent 770c82e57a
commit 4c82add3bc
7 changed files with 24 additions and 32 deletions

View File

@@ -15,21 +15,20 @@ import styles from "./guests-rooms-picker.module.css"
export default function GuestsRoomsPickerForm() {
const intl = useIntl()
const [isOpen, setIsOpen] = useState(false)
const guestsData = guestsRoomsStore().rooms
const { adultCount, childCount, setIsValidated } = guestsRoomsStore()
const { rooms, adultCount, childCount, setIsValidated } = guestsRoomsStore()
const ref = useRef<HTMLDivElement | null>(null)
function handleOnClick() {
setIsOpen((prevIsOpen) => !prevIsOpen)
}
const closePicker = useCallback(() => {
const guestRoomsValidData = guestRoomsSchema.safeParse(guestsData)
const guestRoomsValidData = guestRoomsSchema.safeParse(rooms)
if (guestRoomsValidData.success) {
setIsOpen(false)
setIsValidated(false)
} else {
setIsValidated(true)
}
}, [guestsData, setIsValidated, setIsOpen])
}, [rooms, setIsValidated, setIsOpen])
useEffect(() => {
function handleClickOutside(evt: Event) {
@@ -44,27 +43,26 @@ export default function GuestsRoomsPickerForm() {
}
}, [closePicker])
const selectedRoomsCount = guestsData.length
const childCountLabel =
childCount > 1
? intl.formatMessage({ id: "Children" })
: intl.formatMessage({ id: "Child" })
return (
<div className={styles.container} data-isopen={isOpen} ref={ref}>
<button className={styles.btn} onClick={handleOnClick} type="button">
<Body className={styles.body}>
{selectedRoomsCount}{" "}
{selectedRoomsCount > 1
? intl.formatMessage({ id: "Rooms" })
: intl.formatMessage({ id: "Room" })}
{intl.formatMessage(
{ id: "booking.rooms" },
{ totalRooms: rooms.length }
)}
{", "}
{adultCount}{" "}
{adultCount > 1
? intl.formatMessage({ id: "Adults" })
: intl.formatMessage({ id: "Adult" })}
{childCount > 0 ? ", " + childCount + " " + childCountLabel : null}
{intl.formatMessage(
{ id: "booking.adults" },
{ totalAdults: adultCount }
)}
{childCount > 0
? ", " +
intl.formatMessage(
{ id: "booking.children" },
{ totalChildren: childCount }
)
: null}
</Body>
</button>
<div aria-modal className={styles.hideWrapper} role="dialog">

View File

@@ -9,7 +9,6 @@
"Add new card": "Tilføj nyt kort",
"Address": "Adresse",
"Airport": "Lufthavn",
"Adult": "Voksen",
"Adults": "voksne",
"All our breakfast buffets offer gluten free, vegan, and allergy-friendly options.": "Alle vores morgenmadsbuffeter tilbyder glutenfrie, veganske og allergivenlige muligheder.",
"Already a friend?": "Allerede en ven?",
@@ -46,7 +45,6 @@
"Check in": "Check ind",
"Check out": "Check ud",
"Check out the credit cards saved to your profile. Pay with a saved card when signed in for a smoother web experience.": "Tjek de kreditkort, der er gemt på din profil. Betal med et gemt kort, når du er logget ind for en mere jævn weboplevelse.",
"Child": "Barn",
"Children": "børn",
"Choose room": "Vælg rum",
"Cities": "Byer",
@@ -328,6 +326,7 @@
"Zoom out": "Zoom ud",
"as of today": "pr. dags dato",
"booking.adults": "{totalAdults, plural, one {# voksen} other {# voksne}}",
"booking.children": "{totalChildren, plural, one {# barn} other {# børn}}",
"booking.guests": "Maks {nrOfGuests, plural, one {# gæst} other {# gæster}}",
"booking.nights": "{totalNights, plural, one {# nat} other {# nætter}}",
"booking.rooms": "{totalRooms, plural, one {# værelse} other {# værelser}}",

View File

@@ -9,7 +9,6 @@
"Add new card": "Neue Karte hinzufügen",
"Address": "Adresse",
"Airport": "Flughafen",
"Adult": "Erwachsener",
"Adults": "Erwachsene",
"All our breakfast buffets offer gluten free, vegan, and allergy-friendly options.": "Alle unsere Frühstücksbuffets bieten glutenfreie, vegane und allergikerfreundliche Speisen.",
"Already a friend?": "Sind wir schon Freunde?",
@@ -46,7 +45,6 @@
"Check in": "Einchecken",
"Check out": "Auschecken",
"Check out the credit cards saved to your profile. Pay with a saved card when signed in for a smoother web experience.": "Sehen Sie sich die in Ihrem Profil gespeicherten Kreditkarten an. Bezahlen Sie mit einer gespeicherten Karte, wenn Sie angemeldet sind, für ein reibungsloseres Web-Erlebnis.",
"Child": "Kind",
"Children": "Kinder",
"Choose room": "Zimmer wählen",
"Cities": "Städte",
@@ -328,6 +326,7 @@
"Zoom out": "Verkleinern",
"as of today": "Stand heute",
"booking.adults": "{totalAdults, plural, one {# erwachsene} other {# erwachsene}}",
"booking.children": "{totalChildren, plural, one {# kind} other {# kinder}}",
"booking.guests": "Max {nrOfGuests, plural, one {# gast} other {# gäste}}",
"booking.nights": "{totalNights, plural, one {# nacht} other {# Nächte}}",
"booking.rooms": "{totalRooms, plural, one {# zimmer} other {# räume}}",

View File

@@ -9,7 +9,6 @@
"Add new card": "Add new card",
"Address": "Address",
"Airport": "Airport",
"Adult": "Adult",
"Adults": "Adults",
"Age": "Age",
"All our breakfast buffets offer gluten free, vegan, and allergy-friendly options.": "All our breakfast buffets offer gluten free, vegan, and allergy-friendly options.",
@@ -48,7 +47,6 @@
"Check in": "Check in",
"Check out": "Check out",
"Check out the credit cards saved to your profile. Pay with a saved card when signed in for a smoother web experience.": "Check out the credit cards saved to your profile. Pay with a saved card when signed in for a smoother web experience.",
"Child": "Child",
"Children": "Children",
"Child age is required": "Child age is required",
"Choose room": "Choose room",
@@ -331,6 +329,7 @@
"Zoom out": "Zoom out",
"as of today": "as of today",
"booking.adults": "{totalAdults, plural, one {# adult} other {# adults}}",
"booking.children": "{totalChildren, plural, one {# child} other {# children}}",
"booking.guests": "Max {nrOfGuests, plural, one {# guest} other {# guests}}",
"booking.nights": "{totalNights, plural, one {# night} other {# nights}}",
"booking.rooms": "{totalRooms, plural, one {# room} other {# rooms}}",

View File

@@ -9,7 +9,6 @@
"Add new card": "Lisää uusi kortti",
"Address": "Osoite",
"Airport": "Lentokenttä",
"Adult": "Aikuinen",
"Adults": "Aikuista",
"All our breakfast buffets offer gluten free, vegan, and allergy-friendly options.": "Kaikki aamiaisbuffettimme tarjoavat gluteenittomia, vegaanisia ja allergiaystävällisiä vaihtoehtoja.",
"Already a friend?": "Oletko jo ystävä?",
@@ -46,7 +45,6 @@
"Check in": "Sisäänkirjautuminen",
"Check out": "Uloskirjautuminen",
"Check out the credit cards saved to your profile. Pay with a saved card when signed in for a smoother web experience.": "Tarkista profiiliisi tallennetut luottokortit. Maksa tallennetulla kortilla kirjautuneena, jotta verkkokokemus on sujuvampi.",
"Child": "Lapsi",
"Children": "Lasta",
"Choose room": "Valitse huone",
"Cities": "Kaupungit",
@@ -329,6 +327,7 @@
"Zoom out": "Loitonna",
"as of today": "tänään",
"booking.adults": "{totalAdults, plural, one {# aikuinen} other {# aikuiset}}",
"booking.children": "{totalChildren, plural, one {# lapsi} other {# lasta}}",
"booking.guests": "Max {nrOfGuests, plural, one {# vieras} other {# vieraita}}",
"booking.nights": "{totalNights, plural, one {# yö} other {# yötä}}",
"booking.rooms": "{totalRooms, plural, one {# huone} other {# sviitti}}",

View File

@@ -9,7 +9,6 @@
"Add new card": "Legg til nytt kort",
"Address": "Adresse",
"Airport": "Flyplass",
"Adult": "Voksen",
"Adults": "Voksne",
"All our breakfast buffets offer gluten free, vegan, and allergy-friendly options.": "Alle våre frokostbufféer tilbyr glutenfrie, veganske og allergivennlige alternativer.",
"Already a friend?": "Allerede Friend?",
@@ -46,7 +45,6 @@
"Check in": "Sjekk inn",
"Check out": "Sjekk ut",
"Check out the credit cards saved to your profile. Pay with a saved card when signed in for a smoother web experience.": "Sjekk ut kredittkortene som er lagret på profilen din. Betal med et lagret kort når du er pålogget for en jevnere nettopplevelse.",
"Child": "Barn",
"Children": "Barn",
"Choose room": "Velg rom",
"Cities": "Byer",
@@ -326,6 +324,7 @@
"Zoom out": "Zoom ut",
"as of today": "per i dag",
"booking.adults": "{totalAdults, plural, one {# voksen} other {# voksne}}",
"booking.children": "{totalChildren, plural, one {# barn} other {# barn}}",
"booking.guests": "Maks {nrOfGuests, plural, one {# gjest} other {# gjester}}",
"booking.nights": "{totalNights, plural, one {# natt} other {# netter}}",
"booking.rooms": "{totalRooms, plural, one {# rom} other {# rom}}",

View File

@@ -9,7 +9,6 @@
"Add new card": "Lägg till nytt kort",
"Address": "Adress",
"Airport": "Flygplats",
"Adult": "Vuxen",
"Adults": "Vuxna",
"All our breakfast buffets offer gluten free, vegan, and allergy-friendly options.": "Alla våra frukostbufféer erbjuder glutenfria, veganska och allergivänliga alternativ.",
"Already a friend?": "Är du redan en vän?",
@@ -46,7 +45,6 @@
"Check in": "Checka in",
"Check out": "Checka ut",
"Check out the credit cards saved to your profile. Pay with a saved card when signed in for a smoother web experience.": "Kolla in kreditkorten som sparats i din profil. Betala med ett sparat kort när du är inloggad för en smidigare webbupplevelse.",
"Child": "Barn",
"Children": "Barn",
"Choose room": "Välj rum",
"Cities": "Städer",
@@ -325,6 +323,7 @@
"Zoom in": "Zooma in",
"Zoom out": "Zooma ut",
"booking.adults": "{totalAdults, plural, one {# vuxen} other {# vuxna}}",
"booking.children": "{totalChildren, plural, one {# barn} other {# barn}}",
"booking.guests": "Max {nrOfGuests, plural, one {# gäst} other {# gäster}}",
"booking.nights": "{totalNights, plural, one {# natt} other {# nätter}}",
"booking.rooms": "{totalRooms, plural, one {# rum} other {# rum}}",