Merged in feat/fix-translations (pull request #1244)
Feat: Fix translations for localize * fix: POI translations * fix: update translations Approved-by: Michael Zetterberg Approved-by: Erik Tiekstra
This commit is contained in:
@@ -7,11 +7,12 @@ import FacilitiesCardGrid from "./CardGrid"
|
||||
|
||||
import styles from "./facilities.module.css"
|
||||
|
||||
import type {
|
||||
Facilities,
|
||||
FacilitiesProps,
|
||||
FacilityCardType,
|
||||
FacilityGrid,
|
||||
import {
|
||||
type Facilities,
|
||||
type FacilitiesProps,
|
||||
FacilityCardButtonText,
|
||||
type FacilityCardType,
|
||||
type FacilityGrid,
|
||||
} from "@/types/components/hotelPage/facilities"
|
||||
|
||||
export default async function Facilities({
|
||||
@@ -34,12 +35,9 @@ export default async function Facilities({
|
||||
if (isFacilityCard(card)) {
|
||||
return {
|
||||
...card,
|
||||
heading: intl.formatMessage({ id: card.heading }),
|
||||
secondaryButton: {
|
||||
...card.secondaryButton,
|
||||
title: intl.formatMessage({
|
||||
id: card.secondaryButton.title,
|
||||
}),
|
||||
title: translateButtonText(card.secondaryButton.title),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -48,6 +46,20 @@ export default async function Facilities({
|
||||
}
|
||||
)
|
||||
|
||||
function translateButtonText(text: string) {
|
||||
switch (text) {
|
||||
case FacilityCardButtonText.MEETINGS:
|
||||
return intl.formatMessage({ id: "About meetings & conferences" })
|
||||
case FacilityCardButtonText.RESTAURANT:
|
||||
return intl.formatMessage({ id: "Read more & book a table" })
|
||||
case FacilityCardButtonText.WELLNESS:
|
||||
return intl.formatMessage({ id: "Read more about wellness & exercise" })
|
||||
default:
|
||||
console.warn(`Unsupported option given: ${text}`)
|
||||
return intl.formatMessage({ id: "Read more" })
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<SectionContainer className={styles.grid}>
|
||||
{translatedFacilityGrids.map((cardGrid: FacilityGrid) => (
|
||||
|
||||
@@ -13,6 +13,7 @@ import styles from "./sidebar.module.css"
|
||||
|
||||
import type { SidebarProps } from "@/types/components/hotelPage/map/sidebar"
|
||||
import type { Coordinates } from "@/types/components/maps/coordinates"
|
||||
import { PointOfInterestGroupEnum } from "@/types/enums/pointOfInterest"
|
||||
|
||||
export default function Sidebar({
|
||||
activePoi,
|
||||
@@ -86,6 +87,28 @@ export default function Sidebar({
|
||||
const viewAsMapMsg = intl.formatMessage({ id: "View as map" })
|
||||
const viewAsListMsg = intl.formatMessage({ id: "View as list" })
|
||||
|
||||
function translatePOIGroup(group: PointOfInterestGroupEnum) {
|
||||
switch (group) {
|
||||
case PointOfInterestGroupEnum.PUBLIC_TRANSPORT:
|
||||
return intl.formatMessage({ id: "Public transport" })
|
||||
case PointOfInterestGroupEnum.ATTRACTIONS:
|
||||
return intl.formatMessage({ id: "Attractions" })
|
||||
case PointOfInterestGroupEnum.BUSINESS:
|
||||
return intl.formatMessage({ id: "Business" })
|
||||
case PointOfInterestGroupEnum.LOCATION:
|
||||
return intl.formatMessage({ id: "Location" })
|
||||
case PointOfInterestGroupEnum.PARKING:
|
||||
return intl.formatMessage({ id: "Parking" })
|
||||
case PointOfInterestGroupEnum.SHOPPING_DINING:
|
||||
return intl.formatMessage({ id: "Shopping & Dining" })
|
||||
default:
|
||||
const option: never = group
|
||||
console.warn(`Unsupported group given: ${option}`)
|
||||
|
||||
return intl.formatMessage({ id: "N/A" })
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<aside
|
||||
@@ -124,7 +147,7 @@ export default function Sidebar({
|
||||
>
|
||||
<h3>
|
||||
<PoiMarker group={group} />
|
||||
{intl.formatMessage({ id: group })}
|
||||
{translatePOIGroup(group)}
|
||||
</h3>
|
||||
</Body>
|
||||
<ul className={styles.poiList}>
|
||||
|
||||
@@ -6,6 +6,7 @@ import { getIntl } from "@/i18n"
|
||||
|
||||
import styles from "./facility.module.css"
|
||||
|
||||
import { HealthFacilitiesEnum } from "@/types/components/hotelPage/facilities"
|
||||
import type { FacilityProps } from "@/types/components/hotelPage/sidepeek/facility"
|
||||
|
||||
export default async function Facility({ data }: FacilityProps) {
|
||||
@@ -14,6 +15,26 @@ export default async function Facility({ data }: FacilityProps) {
|
||||
const ordinaryOpeningTimes = data.openingDetails.openingHours.ordinary
|
||||
const weekendOpeningTimes = data.openingDetails.openingHours.weekends
|
||||
|
||||
function translateWellnessType(type: string) {
|
||||
switch (type) {
|
||||
case HealthFacilitiesEnum.Gym:
|
||||
return intl.formatMessage({ id: "Gym" })
|
||||
case HealthFacilitiesEnum.IndoorPool:
|
||||
return intl.formatMessage({ id: "Indoor pool" })
|
||||
case HealthFacilitiesEnum.Jacuzzi:
|
||||
return intl.formatMessage({ id: "Jacuzzi" })
|
||||
case HealthFacilitiesEnum.OutdoorPool:
|
||||
return intl.formatMessage({ id: "Outdoor pool" })
|
||||
case HealthFacilitiesEnum.Relax:
|
||||
return intl.formatMessage({ id: "Relax" })
|
||||
case HealthFacilitiesEnum.Sauna:
|
||||
return intl.formatMessage({ id: "Sauna" })
|
||||
default:
|
||||
console.warn(`Unsupported group given: ${type}`)
|
||||
return intl.formatMessage({ id: "Wellness" })
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.content}>
|
||||
{image?.imageSizes.medium && (
|
||||
@@ -27,7 +48,7 @@ export default async function Facility({ data }: FacilityProps) {
|
||||
)}
|
||||
<div className={styles.information}>
|
||||
<Subtitle color="burgundy" asChild type="one">
|
||||
<Title level="h3">{intl.formatMessage({ id: data.type })}</Title>
|
||||
<Title level="h3">{translateWellnessType(data.type)}</Title>
|
||||
</Subtitle>
|
||||
<div>
|
||||
<Subtitle type="two" color="uiTextHighContrast">
|
||||
|
||||
Reference in New Issue
Block a user