From 64161ead5a822e798246f6f1b92842b5c3b209cb Mon Sep 17 00:00:00 2001 From: Andreas Ellewsen <ae@uio.no> Date: Thu, 3 Feb 2022 14:16:53 +0100 Subject: [PATCH] Use language fallback on sponsor page --- frontend/src/routes/sponsor/frontpage/index.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/frontend/src/routes/sponsor/frontpage/index.tsx b/frontend/src/routes/sponsor/frontpage/index.tsx index 4e987e59..e082f00c 100644 --- a/frontend/src/routes/sponsor/frontpage/index.tsx +++ b/frontend/src/routes/sponsor/frontpage/index.tsx @@ -22,7 +22,7 @@ import { useTranslation, Trans } from 'react-i18next' import { Link } from 'react-router-dom' import { Guest, Role } from 'interfaces' import { isBefore } from 'date-fns' - +import { getRoleName, getRoleOuName } from 'utils' import SponsorGuestButtons from '../../components/sponsorGuestButtons' interface GuestProps { @@ -118,7 +118,7 @@ const Status = ({ status }: StatusProps) => { } const PersonLine = ({ person, role }: PersonLineProps) => { - const [t, i18n] = useTranslation(['common']) + const [t] = useTranslation(['common']) const today = new Date() today.setHours(0, 0, 0, 0) let status = '' @@ -140,13 +140,9 @@ const PersonLine = ({ person, role }: PersonLineProps) => { <TableCell component="th" scope="row"> {`${person.first} ${person.last}`} </TableCell> - <TableCell align="left"> - {i18n.language === 'en' ? role.name_en : role.name_nb} - </TableCell> + <TableCell align="left">{getRoleName(role)}</TableCell> <Status status={status} /> - <TableCell align="left"> - {i18n.language === 'en' ? role.ou_en : role.ou_nb} - </TableCell> + <TableCell align="left">{getRoleOuName(role)}</TableCell> <TableCell align="left"> <Button variant="contained" -- GitLab