diff --git a/ghost/i18n/locales/af/signup-form.json b/ghost/i18n/locales/af/signup-form.json new file mode 100644 index 0000000000..412a1ce1d6 --- /dev/null +++ b/ghost/i18n/locales/af/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "Nou kyk na u e-pos!", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/bg/signup-form.json b/ghost/i18n/locales/bg/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/bg/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/ca/signup-form.json b/ghost/i18n/locales/ca/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/ca/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/context.json b/ghost/i18n/locales/context.json index 52566de7f2..83d0960abc 100644 --- a/ghost/i18n/locales/context.json +++ b/ghost/i18n/locales/context.json @@ -90,6 +90,7 @@ "Plan checkout was cancelled.": "Notification for when a plan checkout was cancelled", "Plan upgrade was cancelled.": "Notification for when a plan upgrade was cancelled", "Please confirm your email address with this link:": "Descriptive text in signup emails, right before the button members click to confirm their address", + "Please enter a valid email address": "", "Please fill in required fields": "Error message when a required field is missing", "Price": "A label to indicate price of a tier", "Re-enable emails": "A button for members to turn-back-on emails, if they have been previously disabled as a result of delivery failures", @@ -108,6 +109,7 @@ "Sign out": "A button to sign out", "Sign up": "A button to sign up", "Signup error: Invalid link": "Notification text when an invalid / expired signup link is used", + "Something went wrong, please try again.": "", "Sorry, that didn’t work.": "Title of a page when an error occured while submitting feedback", "Spam complaints": "A title in the email suppression FAQ", "Start {{amount}}-day free trial": "A button for starting a free trial", @@ -132,6 +134,7 @@ "There was a problem submitting your feedback. Please try again a little later.": "An error message for when submitting feedback has failed", "This email address will not be used.": "This is in the footer of signup verification emails, and comes right after 'If you did not make this request, you can simply delete this message.'", "This site is invite-only, contact the owner for access.": "A message on the member login screen indicating that a site is not-open to public signups", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "", "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "A confirmation message displayed during the signup process, indicating that the person signing up needs to go and check their email - and reminding them to check their spam folder, too", "Try free for {{amount}} days, then {{originalPrice}}.": "A label for an offer with a free trial", "Unlock access to all newsletters by becoming a paid subscriber.": "A message to encourage members to upgrade to a paid subscription", @@ -176,4 +179,4 @@ "{{memberEmail}} will no longer receive this newsletter.": "A message shown when a user unsubscribes from a newsletter", "{{memberEmail}} will no longer receive {{newsletterName}} newsletter.": "A message shown when a user unsubscribes from a newsletter", "{{trialDays}} days free": "A label for free trial days" -} +} \ No newline at end of file diff --git a/ghost/i18n/locales/cs/signup-form.json b/ghost/i18n/locales/cs/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/cs/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/da/signup-form.json b/ghost/i18n/locales/da/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/da/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/de/signup-form.json b/ghost/i18n/locales/de/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/de/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/en/signup-form.json b/ghost/i18n/locales/en/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/en/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/eo/signup-form.json b/ghost/i18n/locales/eo/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/eo/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/es/signup-form.json b/ghost/i18n/locales/es/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/es/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/fi/signup-form.json b/ghost/i18n/locales/fi/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/fi/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/fr/portal.json b/ghost/i18n/locales/fr/portal.json index 79c0a8f616..8ce3d99abf 100644 --- a/ghost/i18n/locales/fr/portal.json +++ b/ghost/i18n/locales/fr/portal.json @@ -39,11 +39,11 @@ "Continue": "Continuer", "Continue subscription": "Continuer l'abonnement", "Could not sign in. Login link expired.": "Impossible de se connecter. Le lien de connexion a expiré.", - "Could not update email! Invalid link.": "Impossible de mettre à jour l'e-mail ! Lien invalide.", + "Could not update email! Invalid link.": "Impossible de mettre à jour l'e-mail\u00a0! Lien invalide.", "Create a new contact": "Créer un nouveau contact", "Current plan": "Plan actuel", "Delete account": "Fermer le compte", - "Didn't mean to do this? Manage your preferences .": "Vous ne vouliez pas faire ça ? Gérez vos préférences .", + "Didn't mean to do this? Manage your preferences .": "Vous ne vouliez pas faire ça\u00a0? Gérez vos préférences .", "Don't have an account?": "Vous n’avez pas encore de compte ?", "Edit": "Modifier", "Email": "E-mail", @@ -99,7 +99,7 @@ "Sign in": "Se connecter", "Sign out": "Se déconnecter", "Sign up": "S’enregistrer", - "Signup error: Invalid link": "Erreur d'inscription : lien invalide", + "Signup error: Invalid link": "Erreur d'inscription\u00a0: lien invalide", "Sorry, that didn’t work.": "Désolé, ça n'a pas fonctionné.", "Spam complaints": "Plaintes pour spam", "Start {{amount}}-day free trial": "Commencer l’essai gratuit de {{amount}} jours", diff --git a/ghost/i18n/locales/fr/signup-form.json b/ghost/i18n/locales/fr/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/fr/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/hu/signup-form.json b/ghost/i18n/locales/hu/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/hu/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/id/signup-form.json b/ghost/i18n/locales/id/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/id/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/it/signup-form.json b/ghost/i18n/locales/it/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/it/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/ko/signup-form.json b/ghost/i18n/locales/ko/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/ko/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/mn/signup-form.json b/ghost/i18n/locales/mn/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/mn/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/nl/signup-form.json b/ghost/i18n/locales/nl/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/nl/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/no/signup-form.json b/ghost/i18n/locales/no/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/no/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/pl/signup-form.json b/ghost/i18n/locales/pl/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/pl/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/pt-BR/signup-form.json b/ghost/i18n/locales/pt-BR/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/pt-BR/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/pt/signup-form.json b/ghost/i18n/locales/pt/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/pt/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/ro/signup-form.json b/ghost/i18n/locales/ro/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/ro/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/ru/signup-form.json b/ghost/i18n/locales/ru/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/ru/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/si/signup-form.json b/ghost/i18n/locales/si/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/si/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/sl/signup-form.json b/ghost/i18n/locales/sl/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/sl/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/sq/signup-form.json b/ghost/i18n/locales/sq/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/sq/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/sr/signup-form.json b/ghost/i18n/locales/sr/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/sr/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/sv/signup-form.json b/ghost/i18n/locales/sv/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/sv/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/tr/signup-form.json b/ghost/i18n/locales/tr/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/tr/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/uk/signup-form.json b/ghost/i18n/locales/uk/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/uk/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/uz/signup-form.json b/ghost/i18n/locales/uz/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/uz/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/vi/signup-form.json b/ghost/i18n/locales/vi/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/vi/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/zh-Hant/signup-form.json b/ghost/i18n/locales/zh-Hant/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/zh-Hant/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/locales/zh/signup-form.json b/ghost/i18n/locales/zh/signup-form.json new file mode 100644 index 0000000000..6ac5ad2750 --- /dev/null +++ b/ghost/i18n/locales/zh/signup-form.json @@ -0,0 +1,6 @@ +{ + "Now check your email!": "", + "Please enter a valid email address": "", + "Something went wrong, please try again.": "", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "" +} diff --git a/ghost/i18n/package.json b/ghost/i18n/package.json index 9ba1ef567f..90d5693421 100644 --- a/ghost/i18n/package.json +++ b/ghost/i18n/package.json @@ -15,9 +15,10 @@ "lint:code": "eslint *.js lib/ --ext .js --cache", "lint": "yarn lint:code && yarn lint:test", "lint:test": "eslint -c test/.eslintrc.js test/ --ext .js --cache", - "translate": "yarn translate:ghost && yarn translate:portal && node generate-context.js", + "translate": "yarn translate:ghost && yarn translate:portal && yarn translate:signup-form && node generate-context.js", "translate:ghost": "NAMESPACE=ghost i18next '../core/core/{frontend,server,shared}/**/*.{js,jsx}'", - "translate:portal": "NAMESPACE=portal i18next '../portal/src/**/*.{js,jsx}'" + "translate:portal": "NAMESPACE=portal i18next '../portal/src/**/*.{js,jsx}'", + "translate:signup-form": "NAMESPACE=signup-form i18next '../signup-form/src/**/*.{ts,tsx}'" }, "files": [ "index.js", diff --git a/ghost/i18n/test/i18n.test.js b/ghost/i18n/test/i18n.test.js index a3aef44499..cdfb92d0cc 100644 --- a/ghost/i18n/test/i18n.test.js +++ b/ghost/i18n/test/i18n.test.js @@ -16,4 +16,18 @@ describe('i18n', function () { }); }); }); + + describe('Can use Signup-form resources', function () { + describe('Afrikaans', function () { + let t; + + before(function () { + t = i18n('af', 'signup-form').t; + }); + + it('can translate `Now check your email!`', function () { + assert.equal(t('Now check your email!'), 'Nou kyk na u e-pos!'); + }); + }); + }); }); diff --git a/ghost/i18n/tsconfig.json b/ghost/i18n/tsconfig.json index d9f1f307aa..5417e61deb 100644 --- a/ghost/i18n/tsconfig.json +++ b/ghost/i18n/tsconfig.json @@ -5,7 +5,8 @@ "emitDeclarationOnly": true, "outDir": "./build", "skipLibCheck": true, - "esModuleInterop": true + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, }, "include": ["lib/**/*.js"], "exclude": ["node_modules", "test"] diff --git a/ghost/signup-form/package.json b/ghost/signup-form/package.json index 56ca882f5a..6a415a0958 100644 --- a/ghost/signup-form/package.json +++ b/ghost/signup-form/package.json @@ -21,6 +21,7 @@ "preview": "concurrently \"vite preview -l silent\" \"vite build --watch\"", "dev:test": "vite build && vite preview --port 6175", "build": "tsc && vite build", + "prebuild": "yarn workspace @tryghost/i18n build", "lint": "yarn run lint:js", "lint:js": "eslint --ext .js,.ts,.cjs,.tsx --cache src test", "test:unit": "yarn build", @@ -72,6 +73,7 @@ "tailwindcss": "3.3.2", "typescript": "5.1.3", "vite": "4.3.9", + "vite-plugin-commonjs": "0.7.1", "vite-plugin-svgr": "3.2.0", "vitest": "0.31.4" } diff --git a/ghost/signup-form/src/App.tsx b/ghost/signup-form/src/App.tsx index 3cf6b11c3f..77ef1f7295 100644 --- a/ghost/signup-form/src/App.tsx +++ b/ghost/signup-form/src/App.tsx @@ -1,3 +1,4 @@ +import * as i18nLib from '@tryghost/i18n'; import React, {ComponentProps} from 'react'; import pages, {Page, PageName} from './pages'; import {AppContextProvider, AppContextType} from './AppContext'; @@ -29,17 +30,18 @@ const App: React.FC = ({scriptTag}) => { } as Page); }; + const i18n = i18nLib.default('en', 'signup-form'); const context: AppContextType = { page, api, options, setPage: _setPage, + t: i18n.t, scriptTag }; const PageComponent = pages[page.name]; const data = page.data as any; // issue with TypeScript understanding the type here when passing it to the component - return ( <> diff --git a/ghost/signup-form/src/AppContext.ts b/ghost/signup-form/src/AppContext.ts index eae000f14f..33543aeed4 100644 --- a/ghost/signup-form/src/AppContext.ts +++ b/ghost/signup-form/src/AppContext.ts @@ -20,6 +20,7 @@ export type AppContextType = { setPage: (name: T, data: ComponentProps) => void, options: SignupFormOptions, api: GhostApi, + t: any, scriptTag: HTMLElement } diff --git a/ghost/signup-form/src/Preview.stories.tsx b/ghost/signup-form/src/Preview.stories.tsx index a6d3ff798c..6add743901 100644 --- a/ghost/signup-form/src/Preview.stories.tsx +++ b/ghost/signup-form/src/Preview.stories.tsx @@ -1,3 +1,4 @@ +import * as i18nLib from '@tryghost/i18n'; import React, {ComponentProps, useState} from 'react'; import pages, {Page, PageName} from './pages'; import {AppContextProvider, SignupFormOptions} from './AppContext'; @@ -26,6 +27,8 @@ const Preview: React.FC diff --git a/ghost/signup-form/src/components/pages/FormPage.tsx b/ghost/signup-form/src/components/pages/FormPage.tsx index 4cbf17ee35..8e1c9bdaab 100644 --- a/ghost/signup-form/src/components/pages/FormPage.tsx +++ b/ghost/signup-form/src/components/pages/FormPage.tsx @@ -7,11 +7,11 @@ import {useAppContext} from '../../AppContext'; export const FormPage: React.FC = () => { const [error, setError] = React.useState(''); const [loading, setLoading] = React.useState(false); - const {api, setPage, options} = useAppContext(); + const {api, setPage, options, t} = useAppContext(); const submit = async ({email}: { email: string }) => { if (!isValidEmail(email)) { - setError('Please enter a valid email address'); + setError(t(`Please enter a valid email address`)); return; } @@ -25,7 +25,7 @@ export const FormPage: React.FC = () => { }); } catch (_) { setLoading(false); - setError('Something went wrong, please try again.'); + setError(t(`Something went wrong, please try again.`)); } }; diff --git a/ghost/signup-form/src/components/pages/SuccessView.tsx b/ghost/signup-form/src/components/pages/SuccessView.tsx index be3d9ea777..92aa98b835 100644 --- a/ghost/signup-form/src/components/pages/SuccessView.tsx +++ b/ghost/signup-form/src/components/pages/SuccessView.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import {useAppContext} from '../../AppContext'; export const SuccessView: React.FC<{ email: string; @@ -8,10 +9,11 @@ export const SuccessView: React.FC<{ backgroundColor?: string; textColor?: string; }> = ({isMinimal, title, logo, backgroundColor, textColor}) => { + const {t} = useAppContext(); if (isMinimal) { return (
-

Now check your email!

+

{t(`Now check your email!`)}

); } @@ -22,8 +24,8 @@ export const SuccessView: React.FC<{ style={{backgroundColor, color: textColor}} > {logo && {title}} -

Now check your email!

-

To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!

+

{t(`Now check your email!`)}

+

{t(`To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!`)}

); }; diff --git a/ghost/signup-form/tsconfig.json b/ghost/signup-form/tsconfig.json index c81ef9f382..c75bff6415 100644 --- a/ghost/signup-form/tsconfig.json +++ b/ghost/signup-form/tsconfig.json @@ -12,6 +12,8 @@ "isolatedModules": true, "noEmit": true, "jsx": "react-jsx", + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, /* Linting */ "strict": true, diff --git a/ghost/signup-form/vite.config.ts b/ghost/signup-form/vite.config.ts index 48f42503cc..4d775a20e0 100644 --- a/ghost/signup-form/vite.config.ts +++ b/ghost/signup-form/vite.config.ts @@ -1,6 +1,8 @@ +import commonjs from 'vite-plugin-commonjs'; import pkg from './package.json'; import react from '@vitejs/plugin-react'; import svgr from 'vite-plugin-svgr'; +import {SUPPORTED_LOCALES} from '@tryghost/i18n'; import {defineConfig} from 'vitest/config'; import {resolve} from 'path'; @@ -11,7 +13,12 @@ export default (function viteConfig() { return defineConfig({ plugins: [ svgr(), - react() + react(), + commonjs({ + dynamic: { + loose: true + } + }) ], define: { 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), @@ -42,7 +49,9 @@ export default (function viteConfig() { output: {} }, commonjsOptions: { - include: [/packages/, /node_modules/] + include: [/ghost/, /node_modules/], + dynamicRequireRoot: '../', + dynamicRequireTargets: SUPPORTED_LOCALES.map(locale => `../i18n/locales/${locale}/signup-form.json`) } }, test: { diff --git a/yarn.lock b/yarn.lock index ffc526c07a..d69fc6bcdd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16090,6 +16090,11 @@ es-module-lexer@^0.9.0, es-module-lexer@^0.9.3: resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.9.3.tgz#6f13db00cc38417137daf74366f535c8eb438f19" integrity sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ== +es-module-lexer@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.2.1.tgz#ba303831f63e6a394983fde2f97ad77b22324527" + integrity sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg== + es-set-tostringtag@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz#338d502f6f674301d710b80c8592de8a15f09cd8" @@ -32680,11 +32685,29 @@ vite-node@0.31.4: picocolors "^1.0.0" vite "^3.0.0 || ^4.0.0" +vite-plugin-commonjs@0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/vite-plugin-commonjs/-/vite-plugin-commonjs-0.7.1.tgz#7e0d20264d355b733e46ed4ed0e7931a113b47e9" + integrity sha512-pRkI+pKW3NygFGTiLRejEntiJL0N+yC1wpnzne2bQ/bAqYwZWAzFU7XgU6EC8GE898ZAKfAZ6bhDP+uL+pM61Q== + dependencies: + acorn "^8.8.2" + fast-glob "^3.2.12" + vite-plugin-dynamic-import "^1.4.0" + vite-plugin-css-injected-by-js@3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/vite-plugin-css-injected-by-js/-/vite-plugin-css-injected-by-js-3.1.1.tgz#8324412636cf6fdada1a86f595aa2e78458e5ddb" integrity sha512-mwrFvEEy0TuH8Ul0cb2HgjmNboQ/JnEFy+kHCWqAJph3ikMOiIuyYVdx0JO4nEIWJyzSnc4TTdmoTulsikvJEg== +vite-plugin-dynamic-import@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/vite-plugin-dynamic-import/-/vite-plugin-dynamic-import-1.4.0.tgz#681fd38e40b36a4d312092b16a2cd96d735ed9d1" + integrity sha512-OBWeCGyWE4iIwCUfx3RK8XwT1BjPAJNeMQmdO5md5Gq8PD8gLMCfUnuEiX9dIQDL9Gdvao1GNRqZwfcpwWDTNw== + dependencies: + acorn "^8.8.2" + es-module-lexer "^1.2.1" + fast-glob "^3.2.12" + vite-plugin-svgr@3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/vite-plugin-svgr/-/vite-plugin-svgr-3.2.0.tgz#920375aaf6635091c9ac8e467825f92d32544476"