From e4d5b8151802517b2943756fc0d09ffa95e2c4e2 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Sat, 29 Jan 2022 18:21:37 +0100 Subject: chore: replace lingui functions with react-intl --- src/components/PostsList/PostsList.tsx | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/components/PostsList/PostsList.tsx') diff --git a/src/components/PostsList/PostsList.tsx b/src/components/PostsList/PostsList.tsx index df9dfe4..16deee3 100644 --- a/src/components/PostsList/PostsList.tsx +++ b/src/components/PostsList/PostsList.tsx @@ -1,9 +1,9 @@ -import { t } from '@lingui/macro'; -import { PostsList as PostsListData } from '@ts/types/blog'; -import styles from './PostsList.module.scss'; import PostPreview from '@components/PostPreview/PostPreview'; -import { ForwardedRef, forwardRef, Fragment } from 'react'; +import { PostsList as PostsListData } from '@ts/types/blog'; import { sortPostsByYear } from '@utils/helpers/sort'; +import { ForwardedRef, forwardRef, Fragment } from 'react'; +import { useIntl } from 'react-intl'; +import styles from './PostsList.module.scss'; const PostsList = ( { @@ -15,6 +15,7 @@ const PostsList = ( }, ref: ForwardedRef ) => { + const intl = useIntl(); const titleLevel = showYears ? 3 : 2; const getPostsListByYear = () => { @@ -32,7 +33,12 @@ const PostsList = (
{showYears && (

- {t`Published in`} + + {intl.formatMessage({ + defaultMessage: 'Published on', + description: 'PostsList: published on year label', + })}{' '} + {year}

)} @@ -62,7 +68,14 @@ const PostsList = ( }; if (page.posts.length === 0) { - return

{t`No results found.`}

; + return ( +

+ {intl.formatMessage({ + defaultMessage: 'No results found.', + description: 'PostsList: no results', + })} +

+ ); } else { return ( -- cgit v1.2.3