From 149151394315e0ac4d3c9a958fe92881ee0aae7d Mon Sep 17 00:00:00 2001 From: Daniel Haarhoff Date: Fri, 18 Oct 2024 12:31:06 +0100 Subject: [PATCH] Extract strings from write-review/published-page Refs: #1817 --- locales/en-US/published-page.json | 53 ++++++++++ .../published-page/published-page.ts | 97 +++++++++++-------- 2 files changed, 109 insertions(+), 41 deletions(-) create mode 100644 locales/en-US/published-page.json diff --git a/locales/en-US/published-page.json b/locales/en-US/published-page.json new file mode 100644 index 000000000..fce842019 --- /dev/null +++ b/locales/en-US/published-page.json @@ -0,0 +1,53 @@ +{ + "title": { + "message": "PREreview published" + }, + "yourDoi": { + "message": "Your DOI" + }, + "whatHappensNext": { + "message": "What happens next" + }, + "whereYouCanSeeYourPrereview": { + "message": "You’ll be able to see your PREreview shortly. It’ll also appear on our {communitySlackLink}{isScietyPreprint, boolean, true { and {scietyLink}} false {}}." + }, + "communitySlack": { + "message": "Community Slack" + }, + "opensInNewTab": { + "message": "opens in a new tab" + }, + "letUsKnowAuthorDetails": { + "message": "Please let us know the other authors’ details (names and ORCID iDs), and we’ll add them to the PREreview. Our email address is {mailtoHelp}." + }, + "sentEmailsToAuthos": { + "message": "We’ve sent emails to the other authors, inviting them to appear." + }, + "shareYourReview": { + "message": "Share your review" + }, + "letCommunityKnow": { + "message": "Let the community know that you published your review." + }, + "writeATweet": { + "message": "Write a Tweet" + }, + "shareOnLinkedin": { + "message": "Share it on LinkedIn" + }, + "listOnSciety": { + "message": "List it on Sciety" + }, + "howItWent": { + "message": "Let us know how it went" + }, + "scheduleAnInterview": { + "message": "Schedule an interview with our product team to discuss your experience on PREreview. We gladly compensate interviewees in appreciation for their help!" + }, + "backToPreprint": { + "message": "Back to preprint" + }, + "skipToMain": { + "message": "Skip to main content" + } +} diff --git a/src/write-review/published-page/published-page.ts b/src/write-review/published-page/published-page.ts index ad70e8c63..38bc2427a 100644 --- a/src/write-review/published-page/published-page.ts +++ b/src/write-review/published-page/published-page.ts @@ -1,6 +1,6 @@ import { format } from 'fp-ts-routing' -import { html, plainText } from '../../html.js' -import type { SupportedLocale } from '../../locales/index.js' +import { html, plainText, rawHtml } from '../../html.js' +import { translate, type SupportedLocale } from '../../locales/index.js' import { templatePage } from '../../page.js' import type { PreprintTitle } from '../../preprint.js' import { preprintReviewsMatch } from '../../routes.js' @@ -13,59 +13,63 @@ export const publishedPage = ({ preprint, url, user, + locale, }: { review: PublishedReview preprint: PreprintTitle url: URL user: User locale: SupportedLocale -}) => - templatePage({ - title: plainText`PREreview published`, +}) => { + const t = translate(locale) + const opensInNewTab = t('published-page', 'opensInNewTab')() + const communitySlackLink = html`${t('published-page', 'communitySlack')()} (${opensInNewTab})`.toString() + const scietyLink = html`Sciety (${opensInNewTab})`.toString() + const mailtoHelp = html`help@prereview.org (${opensInNewTab})`.toString() + + return templatePage({ + title: plainText(t('published-page', 'title')()), content: html`
-

PREreview published

+

${t('published-page', 'title')()}

- Your DOI
+ ${t('published-page', 'yourDoi')()}
${doi}
-

What happens next

+

${t('published-page', 'whatHappensNext')()}

- You’ll be able to see your PREreview shortly. It’ll also appear on our - Community Slack (opens in a new tab)${isScietyPreprint(preprint.id) - ? html` and - Sciety (opens in a new tab)` - : ''}. + ${rawHtml( + t( + 'published-page', + 'whereYouCanSeeYourPrereview', + )({ communitySlackLink, scietyLink, isScietyPreprint: isScietyPreprint(preprint.id) }), + )}

${form.moreAuthors === 'yes' && form.otherAuthors.length === 0 ? html`
-

- Please let us know the other authors’ details (names and ORCID iDs), and we’ll add them to the - PREreview. Our email address is - help@prereview.org (opens in a new tab). -

+

${t('published-page', 'letUsKnowAuthorDetails')({ mailtoHelp })}

` : form.moreAuthors === 'yes' && form.otherAuthors.length > 0 - ? html`

We’ve sent emails to the other authors, inviting them to appear.

` + ? html`

${t('published-page', 'sentEmailsToAuthos')()}

` : ''} -

Share your review

+

${t('published-page', 'shareYourReview')()}

-

Let the community know that you published your review.

+

${t('published-page', 'letCommunityKnow')()}

${t('published-page', 'writeATweet')()} (${opensInNewTab}) Share it on LinkedIn (opens in a new tab)${t('published-page', 'shareOnLinkedin')()} (${opensInNewTab}) ${isScietyPreprint(preprint.id) ? html` List it on Sciety (opens in a new tab)${t('published-page', 'listOnSciety')()} (${opensInNewTab})` : ''}
-

Let us know how it went

+

${t('published-page', 'howItWent')()}

- Schedule an interview (opens in a new tab) - with our product team to discuss your experience on PREreview. We gladly compensate interviewees in - appreciation for their help! + ${rawHtml( + t( + 'published-page', + 'scheduleAnInterview', + )({ + link: (s: string) => + html` + ${s} (${opensInNewTab}) + `.toString(), + }), + )}

- Back to preprint + ${t('published-page', 'backToPreprint')()}
`, - skipLinks: [[html`Skip to main content`, '#main-content']], + skipLinks: [[html`${t('published-page', 'skipToMain')()}`, '#main-content']], type: 'streamline', user, }) +}