diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-03-23 12:29:43 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-03-23 12:29:43 +0100 |
| commit | 4e7a96c5a831882463802cdd4f84fe1464969cb0 (patch) | |
| tree | 528e2766120465bd74e94a8f5d37db7c3cd5a3cc /src/components/Widgets | |
| parent | 3a20d3ef2d6fcb6c77ca5ad6aeaf6179d23ecb3e (diff) | |
refactor: use formatjs swc plugin
I'm not able to configure SWC plugins in Next.js so to make it works,
all translation must have an id.
Diffstat (limited to 'src/components/Widgets')
9 files changed, 25 insertions, 1 deletions
diff --git a/src/components/Widgets/CVPreview/CVPreview.tsx b/src/components/Widgets/CVPreview/CVPreview.tsx index 08a4c72..cf6a8fa 100644 --- a/src/components/Widgets/CVPreview/CVPreview.tsx +++ b/src/components/Widgets/CVPreview/CVPreview.tsx @@ -28,6 +28,7 @@ const CVPreview = ({ <FormattedMessage defaultMessage="Download <link>CV in PDF</link>" description="CVPreview: download as PDF link" + id="xC3Khf" values={{ link: (chunks: string) => ( <Link href={pdf}> diff --git a/src/components/Widgets/RecentPosts/RecentPosts.tsx b/src/components/Widgets/RecentPosts/RecentPosts.tsx index 1a58574..11d8558 100644 --- a/src/components/Widgets/RecentPosts/RecentPosts.tsx +++ b/src/components/Widgets/RecentPosts/RecentPosts.tsx @@ -44,6 +44,7 @@ const RecentPosts = ({ posts }: { posts: PostsList }) => { {intl.formatMessage({ defaultMessage: 'Published on:', description: 'RecentPosts: publication date label', + id: '1h+N2z', })} </dt> <dd> @@ -64,6 +65,7 @@ const RecentPosts = ({ posts }: { posts: PostsList }) => { return intl.formatMessage({ defaultMessage: 'Failed to load.', description: 'RecentPosts: failed to load text', + id: 'iyEh0R', }); if (!data) return <Spinner />; diff --git a/src/components/Widgets/RelatedThematics/RelatedThematics.tsx b/src/components/Widgets/RelatedThematics/RelatedThematics.tsx index 74325bb..a66de82 100644 --- a/src/components/Widgets/RelatedThematics/RelatedThematics.tsx +++ b/src/components/Widgets/RelatedThematics/RelatedThematics.tsx @@ -27,6 +27,7 @@ const RelatedThematics = ({ thematics }: { thematics: ThematicPreview[] }) => { defaultMessage: '{thematicsCount, plural, =0 {Related thematics} one {Related thematic} other {Related thematics}}', description: 'RelatedThematics: widget title', + id: 'qXQETZ', }, { thematicsCount: thematics.length } )} diff --git a/src/components/Widgets/RelatedTopics/RelatedTopics.tsx b/src/components/Widgets/RelatedTopics/RelatedTopics.tsx index 1702e82..992173d 100644 --- a/src/components/Widgets/RelatedTopics/RelatedTopics.tsx +++ b/src/components/Widgets/RelatedTopics/RelatedTopics.tsx @@ -27,6 +27,7 @@ const RelatedTopics = ({ topics }: { topics: TopicPreview[] }) => { defaultMessage: '{topicsCount, plural, =0 {Related topics} one {Related topic} other {Related topics}}', description: 'RelatedTopics: widget title', + id: 'w/lPUh', }, { topicsCount: topicsList.length } )} diff --git a/src/components/Widgets/Sharing/Sharing.tsx b/src/components/Widgets/Sharing/Sharing.tsx index dd2d2a0..45fe3ce 100644 --- a/src/components/Widgets/Sharing/Sharing.tsx +++ b/src/components/Widgets/Sharing/Sharing.tsx @@ -1,5 +1,4 @@ import { ExpandableWidget } from '@components/WidgetParts'; -import { getIntlInstance } from '@utils/helpers/i18n'; import { useRouter } from 'next/router'; import { useEffect, useState } from 'react'; import { useIntl } from 'react-intl'; @@ -58,10 +57,12 @@ const Sharing = ({ excerpt, title }: { excerpt: string; title: string }) => { const intro = intl.formatMessage({ defaultMessage: 'Introduction:', description: 'Sharing: email content prefix', + id: 'yfgMcl', }); const readMore = intl.formatMessage({ defaultMessage: 'Read more here:', description: 'Sharing: content link prefix', + id: 'UsQske', }); const body = `${intro}\n\n"${pageExcerpt}"\n\n${readMore} ${pageUrl}`; sharingUrl += encodeURI(body); @@ -76,6 +77,7 @@ const Sharing = ({ excerpt, title }: { excerpt: string; title: string }) => { { defaultMessage: 'Seen on {domainName}:', description: 'Sharing: seen on text', + id: 'eUXMG4', }, { domainName } ) @@ -101,6 +103,7 @@ const Sharing = ({ excerpt, title }: { excerpt: string; title: string }) => { name: intl.formatMessage({ defaultMessage: 'Diaspora', description: 'Sharing: Diaspora', + id: 'Dhow1m', }), parameters: { content: '', @@ -115,6 +118,7 @@ const Sharing = ({ excerpt, title }: { excerpt: string; title: string }) => { name: intl.formatMessage({ defaultMessage: 'Facebook', description: 'Sharing: Facebook', + id: '7iiaRx', }), parameters: { content: '', @@ -129,6 +133,7 @@ const Sharing = ({ excerpt, title }: { excerpt: string; title: string }) => { name: intl.formatMessage({ defaultMessage: 'LinkedIn', description: 'Sharing: LinkedIn', + id: 'csCQQk', }), parameters: { content: '', @@ -143,6 +148,7 @@ const Sharing = ({ excerpt, title }: { excerpt: string; title: string }) => { name: intl.formatMessage({ defaultMessage: 'Twitter', description: 'Sharing: Twitter', + id: 'WjVBnY', }), parameters: { content: '', @@ -157,6 +163,7 @@ const Sharing = ({ excerpt, title }: { excerpt: string; title: string }) => { name: intl.formatMessage({ defaultMessage: 'Journal du hacker', description: 'Sharing: Journal du hacker', + id: 'P0I+Xm', }), parameters: { content: '', @@ -171,6 +178,7 @@ const Sharing = ({ excerpt, title }: { excerpt: string; title: string }) => { name: intl.formatMessage({ defaultMessage: 'Email', description: 'Sharing: Email', + id: 'lKZm9t', }), parameters: { content: 'body', @@ -200,6 +208,7 @@ const Sharing = ({ excerpt, title }: { excerpt: string; title: string }) => { { defaultMessage: 'Share on {name}', description: 'Sharing: share on social network text', + id: 'ureXFw', }, { name } )} @@ -215,6 +224,7 @@ const Sharing = ({ excerpt, title }: { excerpt: string; title: string }) => { title={intl.formatMessage({ defaultMessage: 'Share', description: 'Sharing: widget title', + id: 'q3U6uI', })} expand={true} > diff --git a/src/components/Widgets/SocialMedia/SocialMedia.tsx b/src/components/Widgets/SocialMedia/SocialMedia.tsx index f96d10f..decf657 100644 --- a/src/components/Widgets/SocialMedia/SocialMedia.tsx +++ b/src/components/Widgets/SocialMedia/SocialMedia.tsx @@ -27,6 +27,7 @@ const SocialMedia = ({ name: intl.formatMessage({ defaultMessage: 'Github', description: 'SocialMedia: Github', + id: 'SWjj4l', }), url: 'https://github.com/ArmandPhilippot', }, @@ -35,6 +36,7 @@ const SocialMedia = ({ name: intl.formatMessage({ defaultMessage: 'Gitlab', description: 'SocialMedia: Gitlab', + id: 'obmlFh', }), url: 'https://gitlab.com/ArmandPhilippot', }, @@ -43,6 +45,7 @@ const SocialMedia = ({ name: intl.formatMessage({ defaultMessage: 'LinkedIn', description: 'SocialMedia: LinkedIn', + id: 'VbcHZ4', }), url: 'https://www.linkedin.com/in/armandphilippot', }, @@ -51,6 +54,7 @@ const SocialMedia = ({ name: intl.formatMessage({ defaultMessage: 'Twitter', description: 'SocialMedia: Twitter', + id: 'IPs/Ck', }), url: 'https://twitter.com/ArmandPhilippot', }, diff --git a/src/components/Widgets/ThematicsList/ThematicsList.tsx b/src/components/Widgets/ThematicsList/ThematicsList.tsx index f50a069..51254ee 100644 --- a/src/components/Widgets/ThematicsList/ThematicsList.tsx +++ b/src/components/Widgets/ThematicsList/ThematicsList.tsx @@ -35,6 +35,7 @@ const ThematicsList = ({ {intl.formatMessage({ defaultMessage: 'Failed to load.', description: 'ThematicsList: failed to load text', + id: 'PxMDzL', })} </ul> ); diff --git a/src/components/Widgets/ToC/ToC.tsx b/src/components/Widgets/ToC/ToC.tsx index 89ca8d4..3f759db 100644 --- a/src/components/Widgets/ToC/ToC.tsx +++ b/src/components/Widgets/ToC/ToC.tsx @@ -9,6 +9,7 @@ const ToC = () => { const title = intl.formatMessage({ defaultMessage: 'Table of contents', description: 'ToC: widget title', + id: 'Zg4L7U', }); const getItems = (headings: Heading[]) => { @@ -19,6 +20,7 @@ const ToC = () => { <FormattedMessage defaultMessage="<a11y>Jump to </a11y>{title}" description="ToC: link" + id="GgIWnN" values={{ title: heading.title, a11y: (chunks: string) => ( @@ -42,6 +44,7 @@ const ToC = () => { defaultMessage: 'Javascript is required to use the table of contents.', description: 'ToC: noscript tag', + id: 'RZzx/4', })} </noscript> <OrderedList items={getItems(headingsTree)} /> diff --git a/src/components/Widgets/TopicsList/TopicsList.tsx b/src/components/Widgets/TopicsList/TopicsList.tsx index 55bf5af..7bc7d70 100644 --- a/src/components/Widgets/TopicsList/TopicsList.tsx +++ b/src/components/Widgets/TopicsList/TopicsList.tsx @@ -35,6 +35,7 @@ const TopicsList = ({ {intl.formatMessage({ defaultMessage: 'Failed to load.', description: 'TopicsList: failed to load text', + id: '00Pf5p', })} </ul> ); |
