From 4e7a96c5a831882463802cdd4f84fe1464969cb0 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 23 Mar 2022 12:29:43 +0100 Subject: 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. --- src/components/Branding/Branding.tsx | 1 + src/components/Breadcrumb/Breadcrumb.tsx | 7 +++++++ src/components/Buttons/ButtonHelp/ButtonHelp.tsx | 1 + src/components/Buttons/ButtonToolbar/ButtonToolbar.tsx | 2 ++ src/components/Comment/Comment.tsx | 5 +++++ src/components/CommentForm/CommentForm.tsx | 12 ++++++++++++ src/components/CommentsList/CommentsList.tsx | 3 +++ src/components/ContactForm/ContactForm.tsx | 8 ++++++++ src/components/Footer/Footer.tsx | 1 + src/components/FooterNav/FooterNav.tsx | 2 ++ src/components/Icons/Moon/Moon.tsx | 1 + src/components/Icons/Sun/Sun.tsx | 1 + src/components/Layouts/Layout.tsx | 2 ++ src/components/MDX/CodeBlock/CodeBlock.tsx | 5 +++++ src/components/MainNav/MainNav.tsx | 8 ++++++++ src/components/MetaItems/Author/Author.tsx | 1 + src/components/MetaItems/CommentsCount/CommentsCount.tsx | 2 ++ src/components/MetaItems/Dates/Dates.tsx | 2 ++ src/components/MetaItems/PostsCount/PostsCount.tsx | 2 ++ src/components/MetaItems/ReadingTime/ReadingTime.tsx | 6 +++++- src/components/MetaItems/Thematics/Thematics.tsx | 1 + src/components/MetaItems/Topics/Topics.tsx | 1 + src/components/MetaItems/Website/Website.tsx | 1 + src/components/Pagination/Pagination.tsx | 5 +++++ src/components/PaginationCursor/PaginationCursor.tsx | 2 ++ src/components/PostFooter/PostFooter.tsx | 1 + src/components/PostPreview/PostPreview.tsx | 1 + src/components/PostsList/PostsList.tsx | 2 ++ src/components/ProjectPreview/ProjectPreview.tsx | 2 ++ src/components/ProjectSummary/ProjectSummary.tsx | 8 ++++++++ src/components/SearchForm/SearchForm.tsx | 3 +++ src/components/Settings/AckeeSelect/AckeeSelect.tsx | 6 ++++++ .../Settings/PrismThemeToggle/PrismThemeToggle.tsx | 1 + src/components/Settings/ReduceMotion/ReduceMotion.tsx | 3 +++ src/components/Settings/Settings.tsx | 1 + src/components/Settings/ThemeToggle/ThemeToggle.tsx | 1 + src/components/Spinner/Spinner.tsx | 1 + src/components/Tooltip/Tooltip.tsx | 2 ++ .../WidgetParts/ExpandableWidget/ExpandableWidget.tsx | 2 ++ src/components/Widgets/CVPreview/CVPreview.tsx | 1 + src/components/Widgets/RecentPosts/RecentPosts.tsx | 2 ++ src/components/Widgets/RelatedThematics/RelatedThematics.tsx | 1 + src/components/Widgets/RelatedTopics/RelatedTopics.tsx | 1 + src/components/Widgets/Sharing/Sharing.tsx | 12 +++++++++++- src/components/Widgets/SocialMedia/SocialMedia.tsx | 4 ++++ src/components/Widgets/ThematicsList/ThematicsList.tsx | 1 + src/components/Widgets/ToC/ToC.tsx | 3 +++ src/components/Widgets/TopicsList/TopicsList.tsx | 1 + src/pages/404.tsx | 5 +++++ src/pages/article/[slug].tsx | 7 +++++++ src/pages/blog/index.tsx | 9 +++++++++ src/pages/blog/page/[id].tsx | 9 ++++++++- src/pages/contact.tsx | 7 +++++++ src/pages/cv.tsx | 7 +++++++ src/pages/index.tsx | 9 +++++++++ src/pages/mentions-legales.tsx | 3 +++ src/pages/projet/[slug].tsx | 2 ++ src/pages/projets.tsx | 2 ++ src/pages/recherche/index.tsx | 9 +++++++++ src/pages/sujet/[slug].tsx | 4 ++++ src/pages/thematique/[slug].tsx | 4 ++++ 61 files changed, 216 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/components/Branding/Branding.tsx b/src/components/Branding/Branding.tsx index 5c76fd2..b19116d 100644 --- a/src/components/Branding/Branding.tsx +++ b/src/components/Branding/Branding.tsx @@ -76,6 +76,7 @@ const Branding: BrandingReturn = ({ isHome = false }) => { { defaultMessage: '{brandingName} picture', description: 'Branding: branding name picture.', + id: 'ILRLTq', }, { brandingName: settings.name, diff --git a/src/components/Breadcrumb/Breadcrumb.tsx b/src/components/Breadcrumb/Breadcrumb.tsx index 92350c0..a7b945a 100644 --- a/src/components/Breadcrumb/Breadcrumb.tsx +++ b/src/components/Breadcrumb/Breadcrumb.tsx @@ -25,6 +25,7 @@ const Breadcrumb = ({ pageTitle }: { pageTitle: string }) => { {intl.formatMessage({ defaultMessage: 'Home', description: 'Breadcrumb: Home item', + id: 'Enij19', })} @@ -37,6 +38,7 @@ const Breadcrumb = ({ pageTitle }: { pageTitle: string }) => { {intl.formatMessage({ defaultMessage: 'Blog', description: 'Breadcrumb: Blog item', + id: 'z0ic9c', })} @@ -51,6 +53,7 @@ const Breadcrumb = ({ pageTitle }: { pageTitle: string }) => { {intl.formatMessage({ defaultMessage: 'Projects', description: 'Breadcrumb: Projects item', + id: 'Igx3qp', })} @@ -70,6 +73,7 @@ const Breadcrumb = ({ pageTitle }: { pageTitle: string }) => { name: intl.formatMessage({ defaultMessage: 'Home', description: 'Breadcrumb: Home item', + id: 'Enij19', }), item: settings.url, }; @@ -83,6 +87,7 @@ const Breadcrumb = ({ pageTitle }: { pageTitle: string }) => { name: intl.formatMessage({ defaultMessage: 'Blog', description: 'Breadcrumb: Blog item', + id: 'z0ic9c', }), item: `${settings.url}/blog`, }; @@ -97,6 +102,7 @@ const Breadcrumb = ({ pageTitle }: { pageTitle: string }) => { name: intl.formatMessage({ defaultMessage: 'Projects', description: 'Breadcrumb: Projects item', + id: 'Igx3qp', }), item: `${settings.url}/projets`, }; @@ -136,6 +142,7 @@ const Breadcrumb = ({ pageTitle }: { pageTitle: string }) => { {intl.formatMessage({ defaultMessage: 'You are here:', description: 'Breadcrumb: You are here prefix', + id: '16zl9Z', })}
    {getItems()}
diff --git a/src/components/Buttons/ButtonHelp/ButtonHelp.tsx b/src/components/Buttons/ButtonHelp/ButtonHelp.tsx index 252e58c..2616a8f 100644 --- a/src/components/Buttons/ButtonHelp/ButtonHelp.tsx +++ b/src/components/Buttons/ButtonHelp/ButtonHelp.tsx @@ -32,6 +32,7 @@ const ButtonHelp = ({ {intl.formatMessage({ defaultMessage: 'Help', description: 'ButtonHelp: screen reader text', + id: 'oPf+XA', })} diff --git a/src/components/Buttons/ButtonToolbar/ButtonToolbar.tsx b/src/components/Buttons/ButtonToolbar/ButtonToolbar.tsx index e9f6079..7ceb70d 100644 --- a/src/components/Buttons/ButtonToolbar/ButtonToolbar.tsx +++ b/src/components/Buttons/ButtonToolbar/ButtonToolbar.tsx @@ -44,6 +44,7 @@ const ButtonToolbar = ( { defaultMessage: 'Close {type}', description: 'ButtonToolbar: Close button', + id: 'SWq8a4', }, { type, @@ -56,6 +57,7 @@ const ButtonToolbar = ( { defaultMessage: 'Open {type}', description: 'ButtonToolbar: Open button', + id: 'Z1eSIz', }, { type, diff --git a/src/components/Comment/Comment.tsx b/src/components/Comment/Comment.tsx index e20c5aa..355363b 100644 --- a/src/components/Comment/Comment.tsx +++ b/src/components/Comment/Comment.tsx @@ -56,6 +56,7 @@ const Comment = ({ { defaultMessage: '{date} at {time}', description: 'Comment: publication date', + id: 'CT3ydM', }, { date, @@ -88,6 +89,7 @@ const Comment = ({ {intl.formatMessage({ defaultMessage: 'Published on:', description: 'Comment: publication date label', + id: 'soj7do', })}
@@ -109,10 +111,12 @@ const Comment = ({ ? intl.formatMessage({ defaultMessage: 'Cancel reply', description: 'Comment: reply button', + id: 'e1Forh', }) : intl.formatMessage({ defaultMessage: 'Reply', description: 'Comment: reply button', + id: 'hzHuCc', })} @@ -148,6 +152,7 @@ const Comment = ({ {intl.formatMessage({ defaultMessage: 'This comment is awaiting moderation.', description: 'Comment: awaiting moderation message', + id: 'rXeTkM', })}

); diff --git a/src/components/CommentForm/CommentForm.tsx b/src/components/CommentForm/CommentForm.tsx index eb7c100..128dc58 100644 --- a/src/components/CommentForm/CommentForm.tsx +++ b/src/components/CommentForm/CommentForm.tsx @@ -63,6 +63,7 @@ const CommentForm = ({ intl.formatMessage({ defaultMessage: 'Thanks for your comment!', description: 'CommentForm: success notice', + id: 'AVUUgG', }) ); } else { @@ -71,6 +72,7 @@ const CommentForm = ({ defaultMessage: 'Thanks for your comment! It is now awaiting moderation.', description: 'CommentForm: success notice but awaiting moderation', + id: 'Ul2NIl', }) ); } @@ -85,6 +87,7 @@ const CommentForm = ({ defaultMessage: 'An unexpected error happened. Comment cannot be submitted.', description: 'CommentForm: error notice', + id: 'cjK9Ad', }) ); } @@ -105,6 +108,7 @@ const CommentForm = ({ defaultMessage: 'Some required fields are empty. Comment cannot be submitted.', description: 'CommentForm: missing required fields', + id: 'Rle+UK', }) ); } @@ -126,21 +130,25 @@ const CommentForm = ({ const nameLabelBody = intl.formatMessage({ defaultMessage: 'Name', description: 'CommentForm: Name field label', + id: 'F7QxJH', }); const emailLabelBody = intl.formatMessage({ defaultMessage: 'Email', description: 'CommentForm: Email field label', + id: 'Oim3rQ', }); const websiteLabelBody = intl.formatMessage({ defaultMessage: 'Website', description: 'CommentForm: Website field label', + id: 'jN+dY5', }); const commentLabelBody = intl.formatMessage({ defaultMessage: 'Comment', description: 'CommentForm: Comment field label', + id: 'J4nhm4', }); return ( @@ -149,6 +157,7 @@ const CommentForm = ({ {intl.formatMessage({ defaultMessage: 'Leave a comment', description: 'CommentForm: Form title', + id: '+aHn7j', })}
{intl.formatMessage({ defaultMessage: 'Send', description: 'CommentForm: Send button', + id: 'WGFOmA', })} @@ -217,6 +228,7 @@ const CommentForm = ({ message={intl.formatMessage({ defaultMessage: 'Submitting...', description: 'CommentForm: submitting message', + id: 'HEJ3Gv', })} /> )} diff --git a/src/components/CommentsList/CommentsList.tsx b/src/components/CommentsList/CommentsList.tsx index 4ea2fc2..0eaac17 100644 --- a/src/components/CommentsList/CommentsList.tsx +++ b/src/components/CommentsList/CommentsList.tsx @@ -25,6 +25,7 @@ const CommentsList = ({ return intl.formatMessage({ defaultMessage: 'Failed to load.', description: 'CommentsList: failed to load', + id: 'Zlkww3', }); } @@ -47,6 +48,7 @@ const CommentsList = ({ {intl.formatMessage({ defaultMessage: 'Comments', description: 'CommentsList: Comments section title', + id: 'Ns8CFb', })} {data && data.length > 0 ? ( @@ -56,6 +58,7 @@ const CommentsList = ({ {intl.formatMessage({ defaultMessage: 'No comments yet.', description: 'CommentsList: No comment message', + id: 'e9L59q', })}

)} diff --git a/src/components/ContactForm/ContactForm.tsx b/src/components/ContactForm/ContactForm.tsx index 48772a0..5af6982 100644 --- a/src/components/ContactForm/ContactForm.tsx +++ b/src/components/ContactForm/ContactForm.tsx @@ -34,6 +34,7 @@ const ContactForm = () => { defaultMessage: 'Warning: mail not sent. Some required fields are empty.', description: 'ContactForm: missing fields message.', + id: 'WpycgB', }) ); return; @@ -57,6 +58,7 @@ const ContactForm = () => { defaultMessage: 'Thanks. Your message was successfully sent. I will answer it as soon as possible.', description: 'ContactForm: success message', + id: 'gQKeF+', }) ); resetForm(); @@ -64,6 +66,7 @@ const ContactForm = () => { const errorPrefix = intl.formatMessage({ defaultMessage: 'An error occurred:', description: 'ContactForm: error message', + id: 'pTxT7N', }); const error = `${errorPrefix} ${mail.message}`; setStatus('error'); @@ -94,21 +97,25 @@ const ContactForm = () => { const nameLabelBody = intl.formatMessage({ defaultMessage: 'Name', description: 'ContactForm: name field label', + id: '6ibqFS', }); const emailLabelBody = intl.formatMessage({ defaultMessage: 'Email', description: 'ContactForm: email field label', + id: 'Vuryko', }); const subjectLabelBody = intl.formatMessage({ defaultMessage: 'Subject', description: 'ContactForm: subject field label', + id: 'uMURuJ', }); const messageLabelBody = intl.formatMessage({ defaultMessage: 'Message', description: 'ContactForm: message field label', + id: '0zBQpa', }); return ( @@ -160,6 +167,7 @@ const ContactForm = () => { {intl.formatMessage({ defaultMessage: 'Send', description: 'ContactForm: send button text', + id: 'X7n7N2', })} diff --git a/src/components/Footer/Footer.tsx b/src/components/Footer/Footer.tsx index 4aa980d..381b4a8 100644 --- a/src/components/Footer/Footer.tsx +++ b/src/components/Footer/Footer.tsx @@ -41,6 +41,7 @@ const Footer = () => { {intl.formatMessage({ defaultMessage: 'Back to top', description: 'Footer: Back to top button', + id: 'dqrd6I', })} diff --git a/src/components/FooterNav/FooterNav.tsx b/src/components/FooterNav/FooterNav.tsx index 7167b69..763e951 100644 --- a/src/components/FooterNav/FooterNav.tsx +++ b/src/components/FooterNav/FooterNav.tsx @@ -12,6 +12,7 @@ const FooterNav = () => { name: intl.formatMessage({ defaultMessage: 'Legal notice', description: 'FooterNav: legal notice link', + id: 'yWjXRx', }), slug: '/mentions-legales', }, @@ -33,6 +34,7 @@ const FooterNav = () => { aria-label={intl.formatMessage({ defaultMessage: 'Footer', description: 'FooterNav: aria-label', + id: 'HTdaZj', })} >
    {navItems}
diff --git a/src/components/Icons/Moon/Moon.tsx b/src/components/Icons/Moon/Moon.tsx index acdf6ae..26f56a1 100644 --- a/src/components/Icons/Moon/Moon.tsx +++ b/src/components/Icons/Moon/Moon.tsx @@ -14,6 +14,7 @@ const MoonIcon = () => { {intl.formatMessage({ defaultMessage: 'Dark theme', description: 'Icons: Moon icon (dark theme)', + id: 'ode0YK', })} diff --git a/src/components/Icons/Sun/Sun.tsx b/src/components/Icons/Sun/Sun.tsx index 44945c2..12f47d3 100644 --- a/src/components/Icons/Sun/Sun.tsx +++ b/src/components/Icons/Sun/Sun.tsx @@ -14,6 +14,7 @@ const SunIcon = () => { {intl.formatMessage({ defaultMessage: 'Light theme', description: 'Icons: Sun icon (light theme)', + id: 'KeRtm/', })} diff --git a/src/components/Layouts/Layout.tsx b/src/components/Layouts/Layout.tsx index 23c1d0e..ada32b3 100644 --- a/src/components/Layouts/Layout.tsx +++ b/src/components/Layouts/Layout.tsx @@ -121,6 +121,7 @@ const Layout = ({ {intl.formatMessage({ defaultMessage: 'Skip to content', description: 'Layout: Skip to content button', + id: 'iqAbyn', })}
@@ -132,6 +133,7 @@ const Layout = ({ defaultMessage: 'Without Javascript, some features may not work like loading more posts or use search. If you want to benefit from these features, please activate Javascript.', description: 'Layout: noscript banner', + id: 'LR70nt', })} diff --git a/src/components/MDX/CodeBlock/CodeBlock.tsx b/src/components/MDX/CodeBlock/CodeBlock.tsx index b5cb30e..69f0124 100644 --- a/src/components/MDX/CodeBlock/CodeBlock.tsx +++ b/src/components/MDX/CodeBlock/CodeBlock.tsx @@ -35,22 +35,27 @@ const CodeBlock = ({ const copyText = intl.formatMessage({ defaultMessage: 'Copy', description: 'Prism: copy button text (no clicked)', + id: '/ly3AC', }); const copiedText = intl.formatMessage({ defaultMessage: 'Copied!', description: 'Prism: copy button text (clicked)', + id: 'OV9r1K', }); const errorText = intl.formatMessage({ defaultMessage: 'Use Ctrl+c to copy', description: 'Prism: error text', + id: 'z9qkcQ', }); const darkTheme = intl.formatMessage({ defaultMessage: 'Dark Theme 🌙', description: 'Prism: toggle dark theme button text', + id: 'nFMdWI', }); const lightTheme = intl.formatMessage({ defaultMessage: 'Light Theme 🌞', description: 'Prism: toggle light theme button text', + id: 'Ua2g2p', }); return ( diff --git a/src/components/MainNav/MainNav.tsx b/src/components/MainNav/MainNav.tsx index dcaba30..9cb6b4c 100644 --- a/src/components/MainNav/MainNav.tsx +++ b/src/components/MainNav/MainNav.tsx @@ -32,6 +32,7 @@ const MainNav = ( name: intl.formatMessage({ defaultMessage: 'Home', description: 'MainNav: home link', + id: 'ZJMNRW', }), slug: '/', }, @@ -40,6 +41,7 @@ const MainNav = ( name: intl.formatMessage({ defaultMessage: 'Blog', description: 'MainNav: blog link', + id: 'zPJifH', }), slug: '/blog', }, @@ -48,6 +50,7 @@ const MainNav = ( name: intl.formatMessage({ defaultMessage: 'Projects', description: 'MainNav: projects link', + id: 'akSutM', }), slug: '/projets', }, @@ -56,6 +59,7 @@ const MainNav = ( name: intl.formatMessage({ defaultMessage: 'Resume', description: 'MainNav: resume link', + id: 'jpv+Nz', }), slug: '/cv', }, @@ -64,6 +68,7 @@ const MainNav = ( name: intl.formatMessage({ defaultMessage: 'Contact', description: 'MainNav: contact link', + id: 'c2NtPj', }), slug: '/contact', }, @@ -124,10 +129,12 @@ const MainNav = ( ? intl.formatMessage({ defaultMessage: 'Close menu', description: 'MainNav: close button', + id: 'dE8xxV', }) : intl.formatMessage({ defaultMessage: 'Open menu', description: 'MainNav: open button', + id: 'azc1GT', })} @@ -136,6 +143,7 @@ const MainNav = ( aria-label={intl.formatMessage({ defaultMessage: 'Primary', description: 'MainNav: aria-label', + id: 'H7C5Bk', })} >
    {navItems}
diff --git a/src/components/MetaItems/Author/Author.tsx b/src/components/MetaItems/Author/Author.tsx index c3d78c2..4ff0086 100644 --- a/src/components/MetaItems/Author/Author.tsx +++ b/src/components/MetaItems/Author/Author.tsx @@ -10,6 +10,7 @@ const Author = ({ name, kind }: { name: string; kind: MetaKind }) => { title={intl.formatMessage({ defaultMessage: 'Written by:', description: 'Author: article author meta label', + id: 'jCyqZS', })} value={name} kind={kind} diff --git a/src/components/MetaItems/CommentsCount/CommentsCount.tsx b/src/components/MetaItems/CommentsCount/CommentsCount.tsx index bd1990d..04cffa6 100644 --- a/src/components/MetaItems/CommentsCount/CommentsCount.tsx +++ b/src/components/MetaItems/CommentsCount/CommentsCount.tsx @@ -15,6 +15,7 @@ const CommentsCount = ({ total, kind }: { total: number; kind: MetaKind }) => { defaultMessage: '{total, plural, =0 {No comments} one {# comment} other {# comments}}', description: 'CommentsCount: comment count value', + id: 'lKGNKx', }, { total } ); @@ -25,6 +26,7 @@ const CommentsCount = ({ total, kind }: { total: number; kind: MetaKind }) => { title={intl.formatMessage({ defaultMessage: 'Comments:', description: 'CommentsCount: comment count meta label', + id: '6BRtAu', })} value={ isArticle() ? ( diff --git a/src/components/MetaItems/Dates/Dates.tsx b/src/components/MetaItems/Dates/Dates.tsx index 04dff3a..4314ed9 100644 --- a/src/components/MetaItems/Dates/Dates.tsx +++ b/src/components/MetaItems/Dates/Dates.tsx @@ -27,6 +27,7 @@ const Dates = ({ title={intl.formatMessage({ defaultMessage: 'Published on:', description: 'Dates: publication date meta label', + id: '52Fev1', })} values={[