Skip to content

Commit

Permalink
fix(events): enhance EventsCard to support multilingual titles
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildmodeOne committed Nov 26, 2024
1 parent c156c6a commit d95e13f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rogue-thi-app/components/cards/EventsCard.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import React, { useEffect, useMemo, useState } from 'react'
import ListGroup from 'react-bootstrap/ListGroup'
import { useRouter } from 'next/router'

Expand All @@ -16,7 +16,8 @@ import { useTranslation } from 'next-i18next'
export default function EventsCard() {
const router = useRouter()
const [calendar, setCalendar] = useState([])
const { t } = useTranslation(['dashboard'])
const { t, i18n } = useTranslation(['dashboard'])
const locale = useMemo(() => i18n.languages[0], [i18n.languages])

useEffect(() => {
async function load() {
Expand All @@ -40,7 +41,7 @@ export default function EventsCard() {
<ListGroup variant="flush">
{calendar.slice(0, 2).map((x, i) => (
<ListGroup.Item key={i}>
<div>{x.title}</div>
<div>{x.title[locale]}</div>
{x.host?.name && (
<div className="text-muted">
{t('events.organizer.attribute')} {x.host.name}
Expand Down

0 comments on commit d95e13f

Please sign in to comment.