fix(SW-2425): filter description should be translated with lokalise * fix(SW-2425): filter description should be translated with lokalise Approved-by: Anton Gunnarsson
24 lines
691 B
TypeScript
24 lines
691 B
TypeScript
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
|
|
|
import type { IntlShape } from "react-intl"
|
|
|
|
export function getFeatureDescription(
|
|
code: string,
|
|
description: string,
|
|
intl: IntlShape
|
|
): string {
|
|
const roomFeatureDescriptions: Record<string, string> = {
|
|
[RoomPackageCodeEnum.ACCESSIBILITY_ROOM]: intl.formatMessage({
|
|
defaultMessage: "Accessible room",
|
|
}),
|
|
[RoomPackageCodeEnum.ALLERGY_ROOM]: intl.formatMessage({
|
|
defaultMessage: "Allergy-friendly room",
|
|
}),
|
|
[RoomPackageCodeEnum.PET_ROOM]: intl.formatMessage({
|
|
defaultMessage: "Pet-friendly room",
|
|
}),
|
|
}
|
|
|
|
return roomFeatureDescriptions[code] ?? description
|
|
}
|