@@ -3,7 +3,7 @@ import { Icon } from '@equinor/eds-core-react'
33import { world } from '@equinor/eds-icons'
44import { toPlainText } from '@portabletext/react'
55import type { PortableTextBlock } from '@portabletext/types'
6- import { useFormatter , useTranslations } from 'next-intl'
6+ import { useFormatter , useLocale , useTranslations } from 'next-intl'
77import { forwardRef , type HTMLAttributes } from 'react'
88import { twMerge } from 'tailwind-merge'
99import FormattedDateTime , {
@@ -18,6 +18,8 @@ import {
1818} from '@/styles/colorKeyToUtilityMap'
1919import AddToCalendar from '../../../core/AddToCalendar/AddToCalendar'
2020import Blocks from '../../../portableText/Blocks'
21+ import { defaultLanguage } from '@/languageConfig'
22+ import { getLocaleFromIso } from '@/sanity/helpers/localization'
2123
2224type Variants = 'default' | 'single' | 'carousel'
2325
@@ -71,6 +73,10 @@ const EventCard = forwardRef<HTMLDivElement, EventCardProps>(function EventCard(
7173 endDayAndTime,
7274 } = data
7375
76+ const iso = useLocale ( )
77+ const locale = iso !== defaultLanguage . name ? getLocaleFromIso ( iso ) :""
78+ const href = ( "/" + locale + slug ) || ''
79+
7480 const formatter = useFormatter ( )
7581 const { start, end } = getEventDates ( eventDate )
7682 const { dayTime : startDayTime , overrideTimeLabel : startTimeLabel } =
@@ -93,7 +99,7 @@ const EventCard = forwardRef<HTMLDivElement, EventCardProps>(function EventCard(
9399 className ,
94100 ) }
95101 >
96- < BaseLink href = { slug } className = 'mb-6 hover:underline' >
102+ < BaseLink href = { href } className = 'mb-6 hover:underline' >
97103 < Blocks
98104 value = { title }
99105 as = { hasSectionTitle ? 'h3' : 'h2' }
0 commit comments