diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-29 18:21:37 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-29 19:02:57 +0100 |
| commit | e4d5b8151802517b2943756fc0d09ffa95e2c4e2 (patch) | |
| tree | 9e99137a7b64ea7993a8311a7162336a551be8b2 /src/components/Widgets/TopicsList/TopicsList.tsx | |
| parent | 47b854de26dea24e7838fd0804df103dee99635f (diff) | |
chore: replace lingui functions with react-intl
Diffstat (limited to 'src/components/Widgets/TopicsList/TopicsList.tsx')
| -rw-r--r-- | src/components/Widgets/TopicsList/TopicsList.tsx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/components/Widgets/TopicsList/TopicsList.tsx b/src/components/Widgets/TopicsList/TopicsList.tsx index 5b0c44e..80341c3 100644 --- a/src/components/Widgets/TopicsList/TopicsList.tsx +++ b/src/components/Widgets/TopicsList/TopicsList.tsx @@ -1,10 +1,10 @@ import Spinner from '@components/Spinner/Spinner'; import { ExpandableWidget, List } from '@components/WidgetParts'; -import { t } from '@lingui/macro'; import { getAllTopics } from '@services/graphql/queries'; import { TitleLevel } from '@ts/types/app'; import Link from 'next/link'; import { useRouter } from 'next/router'; +import { useIntl } from 'react-intl'; import useSWR from 'swr'; const TopicsList = ({ @@ -14,6 +14,7 @@ const TopicsList = ({ title: string; titleLevel?: TitleLevel; }) => { + const intl = useIntl(); const router = useRouter(); const isTopic = () => router.asPath.includes('/sujet/'); const currentTopicSlug = isTopic() @@ -23,7 +24,15 @@ const TopicsList = ({ const { data, error } = useSWR('/api/topics', getAllTopics); const getList = () => { - if (error) return <ul>{t`Failed to load.`}</ul>; + if (error) + return ( + <ul> + {intl.formatMessage({ + defaultMessage: 'Failed to load.', + description: 'TopicsList: failed to load text', + })} + </ul> + ); if (!data) return ( <ul> |
