From 258dc2f8f29fd127cc06e867118daf5466785d60 Mon Sep 17 00:00:00 2001 From: Simon Backx Date: Fri, 2 Jun 2023 14:29:04 +0200 Subject: [PATCH] Added locale data option to signup form script refs https://github.com/TryGhost/Team/issues/3307 --- .../modals/settings/signup-form-embed.js | 3 ++- ghost/i18n/locales/af/signup-form.json | 1 + ghost/i18n/locales/bg/signup-form.json | 1 + ghost/i18n/locales/ca/signup-form.json | 1 + ghost/i18n/locales/cs/signup-form.json | 1 + ghost/i18n/locales/da/signup-form.json | 1 + ghost/i18n/locales/de/signup-form.json | 1 + ghost/i18n/locales/en/signup-form.json | 1 + ghost/i18n/locales/eo/signup-form.json | 1 + ghost/i18n/locales/es/signup-form.json | 1 + ghost/i18n/locales/fi/signup-form.json | 1 + ghost/i18n/locales/fr/signup-form.json | 1 + ghost/i18n/locales/hu/signup-form.json | 1 + ghost/i18n/locales/id/signup-form.json | 1 + ghost/i18n/locales/it/signup-form.json | 1 + ghost/i18n/locales/ko/signup-form.json | 1 + ghost/i18n/locales/mn/signup-form.json | 1 + ghost/i18n/locales/nl/signup-form.json | 9 +++++---- ghost/i18n/locales/no/signup-form.json | 1 + ghost/i18n/locales/pl/signup-form.json | 1 + ghost/i18n/locales/pt-BR/signup-form.json | 1 + ghost/i18n/locales/pt/signup-form.json | 1 + ghost/i18n/locales/ro/signup-form.json | 1 + ghost/i18n/locales/ru/signup-form.json | 1 + ghost/i18n/locales/si/signup-form.json | 1 + ghost/i18n/locales/sl/signup-form.json | 1 + ghost/i18n/locales/sq/signup-form.json | 1 + ghost/i18n/locales/sr/signup-form.json | 1 + ghost/i18n/locales/sv/signup-form.json | 1 + ghost/i18n/locales/tr/signup-form.json | 1 + ghost/i18n/locales/uk/signup-form.json | 1 + ghost/i18n/locales/uz/signup-form.json | 1 + ghost/i18n/locales/vi/signup-form.json | 1 + ghost/i18n/locales/zh-Hant/signup-form.json | 1 + ghost/i18n/locales/zh/signup-form.json | 1 + ghost/signup-form/index.html | 4 ++++ ghost/signup-form/preview.html | 19 +++++++++++++++++++ ghost/signup-form/src/App.tsx | 2 +- ghost/signup-form/src/AppContext.ts | 1 + ghost/signup-form/src/Preview.stories.tsx | 9 ++++++--- .../src/components/pages/FormView.tsx | 4 +++- ghost/signup-form/src/utils/options.tsx | 3 ++- 42 files changed, 76 insertions(+), 11 deletions(-) diff --git a/ghost/admin/app/components/modals/settings/signup-form-embed.js b/ghost/admin/app/components/modals/settings/signup-form-embed.js index 582861b16e..63dca52458 100644 --- a/ghost/admin/app/components/modals/settings/signup-form-embed.js +++ b/ghost/admin/app/components/modals/settings/signup-form-embed.js @@ -79,7 +79,8 @@ export default class SignupFormEmbedModal extends Component { const options = { site: siteUrl, 'button-color': this.settings.accentColor, - 'button-text-color': textColorForBackgroundColor(this.settings.accentColor).hex() + 'button-text-color': textColorForBackgroundColor(this.settings.accentColor).hex(), + locale: this.settings.locale }; for (const [i, label] of this.labels.entries()) { diff --git a/ghost/i18n/locales/af/signup-form.json b/ghost/i18n/locales/af/signup-form.json index 412a1ce1d6..ae2dbe96f2 100644 --- a/ghost/i18n/locales/af/signup-form.json +++ b/ghost/i18n/locales/af/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "Nou kyk na u e-pos!", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/bg/signup-form.json +++ b/ghost/i18n/locales/bg/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/ca/signup-form.json +++ b/ghost/i18n/locales/ca/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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/cs/signup-form.json b/ghost/i18n/locales/cs/signup-form.json index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/cs/signup-form.json +++ b/ghost/i18n/locales/cs/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/da/signup-form.json +++ b/ghost/i18n/locales/da/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/de/signup-form.json +++ b/ghost/i18n/locales/de/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/en/signup-form.json +++ b/ghost/i18n/locales/en/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/eo/signup-form.json +++ b/ghost/i18n/locales/eo/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/es/signup-form.json +++ b/ghost/i18n/locales/es/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/fi/signup-form.json +++ b/ghost/i18n/locales/fi/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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/signup-form.json b/ghost/i18n/locales/fr/signup-form.json index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/fr/signup-form.json +++ b/ghost/i18n/locales/fr/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/hu/signup-form.json +++ b/ghost/i18n/locales/hu/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/id/signup-form.json +++ b/ghost/i18n/locales/id/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/it/signup-form.json +++ b/ghost/i18n/locales/it/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/ko/signup-form.json +++ b/ghost/i18n/locales/ko/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/mn/signup-form.json +++ b/ghost/i18n/locales/mn/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..6961951547 100644 --- a/ghost/i18n/locales/nl/signup-form.json +++ b/ghost/i18n/locales/nl/signup-form.json @@ -1,6 +1,7 @@ { - "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!": "" + "Now check your email!": "Bekijk nu jouw e-mails!", + "Please enter a valid email address": "Vul een geldig e-mailadres in", + "Something went wrong, please try again.": "Er ginet is mis, probeer het opnieuw.", + "Subscribe": "Inschrijven", + "To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "Om jouw inschrijving te voltooien, klik op de bevestigingslink in jouw inbox. Als het niet binnen 3 minuten aankomt, controleer dan jouw spamfolder!" } diff --git a/ghost/i18n/locales/no/signup-form.json b/ghost/i18n/locales/no/signup-form.json index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/no/signup-form.json +++ b/ghost/i18n/locales/no/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/pl/signup-form.json +++ b/ghost/i18n/locales/pl/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/pt-BR/signup-form.json +++ b/ghost/i18n/locales/pt-BR/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/pt/signup-form.json +++ b/ghost/i18n/locales/pt/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/ro/signup-form.json +++ b/ghost/i18n/locales/ro/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/ru/signup-form.json +++ b/ghost/i18n/locales/ru/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/si/signup-form.json +++ b/ghost/i18n/locales/si/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/sl/signup-form.json +++ b/ghost/i18n/locales/sl/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/sq/signup-form.json +++ b/ghost/i18n/locales/sq/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/sr/signup-form.json +++ b/ghost/i18n/locales/sr/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/sv/signup-form.json +++ b/ghost/i18n/locales/sv/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/tr/signup-form.json +++ b/ghost/i18n/locales/tr/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/uk/signup-form.json +++ b/ghost/i18n/locales/uk/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/uz/signup-form.json +++ b/ghost/i18n/locales/uz/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/vi/signup-form.json +++ b/ghost/i18n/locales/vi/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/zh-Hant/signup-form.json +++ b/ghost/i18n/locales/zh-Hant/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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 index 6ac5ad2750..bf835eed18 100644 --- a/ghost/i18n/locales/zh/signup-form.json +++ b/ghost/i18n/locales/zh/signup-form.json @@ -2,5 +2,6 @@ "Now check your email!": "", "Please enter a valid email address": "", "Something went wrong, please try again.": "", + "Subscribe": "", "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/index.html b/ghost/signup-form/index.html index 6b2e53cb2c..1ad24aecef 100644 --- a/ghost/signup-form/index.html +++ b/ghost/signup-form/index.html @@ -80,6 +80,10 @@ async > + +
+

Translated

+

Use production build, since the multiple languages aren't working well with modules.

diff --git a/ghost/signup-form/preview.html b/ghost/signup-form/preview.html index 7b92747b0a..4b7083aa95 100644 --- a/ghost/signup-form/preview.html +++ b/ghost/signup-form/preview.html @@ -75,6 +75,25 @@ async > + +
+

Translated

+ +
+ +
diff --git a/ghost/signup-form/src/App.tsx b/ghost/signup-form/src/App.tsx index 77ef1f7295..2c33eb8790 100644 --- a/ghost/signup-form/src/App.tsx +++ b/ghost/signup-form/src/App.tsx @@ -30,7 +30,7 @@ const App: React.FC = ({scriptTag}) => { } as Page); }; - const i18n = i18nLib.default('en', 'signup-form'); + const i18n = i18nLib.default(options.locale, 'signup-form'); const context: AppContextType = { page, api, diff --git a/ghost/signup-form/src/AppContext.ts b/ghost/signup-form/src/AppContext.ts index 33543aeed4..4bc1c8bbf0 100644 --- a/ghost/signup-form/src/AppContext.ts +++ b/ghost/signup-form/src/AppContext.ts @@ -13,6 +13,7 @@ export type SignupFormOptions = { buttonTextColor?: string, site: string, labels: string[], + locale: string }; export type AppContextType = { diff --git a/ghost/signup-form/src/Preview.stories.tsx b/ghost/signup-form/src/Preview.stories.tsx index 6add743901..e92185b241 100644 --- a/ghost/signup-form/src/Preview.stories.tsx +++ b/ghost/signup-form/src/Preview.stories.tsx @@ -88,7 +88,8 @@ export const Full: Story = { labels: ['label-1', 'label-2'], simulateApiError: false, pageBackgroundColor: '#ffffff', - pageTextColor: '#000000' + pageTextColor: '#000000', + locale: 'en' }, play @@ -102,7 +103,8 @@ export const Minimal: Story = { buttonTextColor: '#ffffff', simulateApiError: false, pageBackgroundColor: '#ffffff', - pageTextColor: '#000000' + pageTextColor: '#000000', + locale: 'en' }, play @@ -116,7 +118,8 @@ export const MinimalOnDark: Story = { buttonTextColor: '#ffffff', simulateApiError: false, pageBackgroundColor: '#122334', - pageTextColor: '#f7f7f7' + pageTextColor: '#f7f7f7', + locale: 'en' }, play diff --git a/ghost/signup-form/src/components/pages/FormView.tsx b/ghost/signup-form/src/components/pages/FormView.tsx index 67e789dca2..524de16b68 100644 --- a/ghost/signup-form/src/components/pages/FormView.tsx +++ b/ghost/signup-form/src/components/pages/FormView.tsx @@ -1,4 +1,5 @@ import React, {FormEventHandler} from 'react'; +import {useAppContext} from '../../AppContext'; export const FormView: React.FC = ({loading, error, buttonColor, buttonTextColor, onSubmit}) => { const [email, setEmail] = React.useState(''); + const {t} = useAppContext(); const borderStyle = error ? '!border-red-500' : 'border-grey-300'; @@ -65,7 +67,7 @@ const Form: React.FC = ({loading, error, buttonColor, buttonTextColor disabled={loading} style={{backgroundColor: buttonColor, color: buttonTextColor}} type='submit' - >Subscribe + >{t('Subscribe')} {error &&

{error}

} diff --git a/ghost/signup-form/src/utils/options.tsx b/ghost/signup-form/src/utils/options.tsx index bb9b68d8cc..4c98af95be 100644 --- a/ghost/signup-form/src/utils/options.tsx +++ b/ghost/signup-form/src/utils/options.tsx @@ -18,7 +18,8 @@ export function useOptions(scriptTag: HTMLElement) { buttonColor: scriptTag.dataset.buttonColor || undefined, buttonTextColor: scriptTag.dataset.buttonTextColor || undefined, site: scriptTag.dataset.site || window.location.origin, - labels + labels, + locale: scriptTag.dataset.locale || 'en' }; }, [scriptTag]);