Rewrite t to be called as a normal function
[MAILPOET-2677]
This commit is contained in:
committed by
Veljko V
parent
d1968dfe50
commit
c1c845ab8d
@@ -1,3 +1,3 @@
|
|||||||
import MailPoet from 'mailpoet';
|
import MailPoet from 'mailpoet';
|
||||||
|
|
||||||
export default ([word]: TemplateStringsArray) => MailPoet.I18n.t(word);
|
export default (word: string): string => MailPoet.I18n.t(word);
|
||||||
|
@@ -33,12 +33,12 @@ export default (props: Props) => {
|
|||||||
{' '}
|
{' '}
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
title={t`previewPage`}
|
title={t('previewPage')}
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
href={selectedPage.url[props.preview]}
|
href={selectedPage.url[props.preview]}
|
||||||
data-automation-id={props.linkAutomationId}
|
data-automation-id={props.linkAutomationId}
|
||||||
>
|
>
|
||||||
{t`preview`}
|
{t('preview')}
|
||||||
</a>
|
</a>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@@ -16,21 +16,21 @@ export default () => {
|
|||||||
current={current}
|
current={current}
|
||||||
automationId="basic_settings_tab"
|
automationId="basic_settings_tab"
|
||||||
>
|
>
|
||||||
{t`basicsTab`}
|
{t('basicsTab')}
|
||||||
</TabLink>
|
</TabLink>
|
||||||
<a
|
<a
|
||||||
className="nav-tab"
|
className="nav-tab"
|
||||||
href="?page=mailpoet-settings#signup"
|
href="?page=mailpoet-settings#signup"
|
||||||
data-automation-id="signup_settings_tab"
|
data-automation-id="signup_settings_tab"
|
||||||
>
|
>
|
||||||
{t`signupConfirmationTab`}
|
{t('signupConfirmationTab')}
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
className="nav-tab"
|
className="nav-tab"
|
||||||
href="?page=mailpoet-settings#mta"
|
href="?page=mailpoet-settings#mta"
|
||||||
data-automation-id="send_with_settings_tab"
|
data-automation-id="send_with_settings_tab"
|
||||||
>
|
>
|
||||||
{t`sendWithTab`}
|
{t('sendWithTab')}
|
||||||
</a>
|
</a>
|
||||||
{hasWooCommerce && (
|
{hasWooCommerce && (
|
||||||
<a
|
<a
|
||||||
@@ -38,7 +38,7 @@ export default () => {
|
|||||||
href="?page=mailpoet-settings#woocommerce"
|
href="?page=mailpoet-settings#woocommerce"
|
||||||
data-automation-id="woocommerce_settings_tab"
|
data-automation-id="woocommerce_settings_tab"
|
||||||
>
|
>
|
||||||
{t`wooCommerceTab`}
|
{t('wooCommerceTab')}
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
<a
|
<a
|
||||||
@@ -46,14 +46,14 @@ export default () => {
|
|||||||
href="?page=mailpoet-settings#advanced"
|
href="?page=mailpoet-settings#advanced"
|
||||||
data-automation-id="settings-advanced-tab"
|
data-automation-id="settings-advanced-tab"
|
||||||
>
|
>
|
||||||
{t`advancedTab`}
|
{t('advancedTab')}
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
className="nav-tab"
|
className="nav-tab"
|
||||||
href="?page=mailpoet-settings#premium"
|
href="?page=mailpoet-settings#premium"
|
||||||
data-automation-id="activation_settings_tab"
|
data-automation-id="activation_settings_tab"
|
||||||
>
|
>
|
||||||
{t`keyActivationTab`}
|
{t('keyActivationTab')}
|
||||||
</a>
|
</a>
|
||||||
</h2>
|
</h2>
|
||||||
);
|
);
|
||||||
|
@@ -19,16 +19,16 @@ export default function DefaultSender() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Label
|
<Label
|
||||||
title={t`defaultSenderTitle`}
|
title={t('defaultSenderTitle')}
|
||||||
description={t`defaultSenderDescription`}
|
description={t('defaultSenderDescription')}
|
||||||
htmlFor="sender-name"
|
htmlFor="sender-name"
|
||||||
/>
|
/>
|
||||||
<Inputs>
|
<Inputs>
|
||||||
<label htmlFor="sender-name">{t`from`}</label>
|
<label htmlFor="sender-name">{t('from')}</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
id="sender-name"
|
id="sender-name"
|
||||||
placeholder={t`yourName`}
|
placeholder={t('yourName')}
|
||||||
data-automation-id="from-name-field"
|
data-automation-id="from-name-field"
|
||||||
value={senderName}
|
value={senderName}
|
||||||
onChange={onChange(setSenderName)}
|
onChange={onChange(setSenderName)}
|
||||||
@@ -42,7 +42,7 @@ export default function DefaultSender() {
|
|||||||
/>
|
/>
|
||||||
{invalidSenderEmail && (
|
{invalidSenderEmail && (
|
||||||
<span className="mailpoet_error_item mailpoet_error">
|
<span className="mailpoet_error_item mailpoet_error">
|
||||||
{t`invalidEmail`}
|
{t('invalidEmail')}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
<div className="regular-text">
|
<div className="regular-text">
|
||||||
@@ -55,7 +55,7 @@ export default function DefaultSender() {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
id="reply_to-name"
|
id="reply_to-name"
|
||||||
placeholder={t`yourName`}
|
placeholder={t('yourName')}
|
||||||
data-automation-id="reply_to-name-field"
|
data-automation-id="reply_to-name-field"
|
||||||
value={replyToName}
|
value={replyToName}
|
||||||
onChange={onChange(setReplyToName)}
|
onChange={onChange(setReplyToName)}
|
||||||
@@ -69,7 +69,7 @@ export default function DefaultSender() {
|
|||||||
/>
|
/>
|
||||||
{invalidReplyToEmail && (
|
{invalidReplyToEmail && (
|
||||||
<span className="mailpoet_error_item mailpoet_error">
|
<span className="mailpoet_error_item mailpoet_error">
|
||||||
{t`invalidEmail`}
|
{t('invalidEmail')}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</Inputs>
|
</Inputs>
|
||||||
|
@@ -6,19 +6,19 @@ export default function GdprCompliant() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Label
|
<Label
|
||||||
title={t`gdprTitle`}
|
title={t('gdprTitle')}
|
||||||
description={t`gdprDescription`}
|
description={t('gdprDescription')}
|
||||||
htmlFor="gdpr-compliant"
|
htmlFor="gdpr-compliant"
|
||||||
/>
|
/>
|
||||||
<Inputs>
|
<Inputs>
|
||||||
<a
|
<a
|
||||||
href="https://kb.mailpoet.com/article/246-guide-to-conform-to-gdpr"
|
href="https://kb.mailpoet.com/article/246-guide-to-conform-to-gdpr"
|
||||||
data-beacon-article="5a9e8cdd04286374f7089a8c"
|
data-beacon-article="5a9e8cdd04286374f7089a8c"
|
||||||
title={t`readGuide`}
|
title={t('readGuide')}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
{t`readGuide`}
|
{t('readGuide')}
|
||||||
</a>
|
</a>
|
||||||
</Inputs>
|
</Inputs>
|
||||||
</>
|
</>
|
||||||
|
@@ -16,13 +16,13 @@ export default function Basics() {
|
|||||||
<DefaultSender />
|
<DefaultSender />
|
||||||
<SubscribeOn
|
<SubscribeOn
|
||||||
event="on_comment"
|
event="on_comment"
|
||||||
title={t`subscribeInCommentsTitle`}
|
title={t('subscribeInCommentsTitle')}
|
||||||
description={t`subscribeInCommentsDescription`}
|
description={t('subscribeInCommentsDescription')}
|
||||||
/>
|
/>
|
||||||
<SubscribeOn
|
<SubscribeOn
|
||||||
event="on_register"
|
event="on_register"
|
||||||
title={t`subscribeInRegistrationTitle`}
|
title={t('subscribeInRegistrationTitle')}
|
||||||
description={t`subscribeInRegistrationDescription`}
|
description={t('subscribeInRegistrationDescription')}
|
||||||
/>
|
/>
|
||||||
<ManageSubscription />
|
<ManageSubscription />
|
||||||
<UnsubscribePage />
|
<UnsubscribePage />
|
||||||
@@ -30,13 +30,13 @@ export default function Basics() {
|
|||||||
<NewSubscriberNotifications />
|
<NewSubscriberNotifications />
|
||||||
<Shortcode
|
<Shortcode
|
||||||
name="mailpoet_archive"
|
name="mailpoet_archive"
|
||||||
title={t`archiveShortcodeTitle`}
|
title={t('archiveShortcodeTitle')}
|
||||||
description={t`archiveShortcodeDescription`}
|
description={t('archiveShortcodeDescription')}
|
||||||
/>
|
/>
|
||||||
<Shortcode
|
<Shortcode
|
||||||
name="mailpoet_subscribers_count"
|
name="mailpoet_subscribers_count"
|
||||||
title={t`subscribersCountShortcodeTitle`}
|
title={t('subscribersCountShortcodeTitle')}
|
||||||
description={t`subscribersCountShortcodeDescription`}
|
description={t('subscribersCountShortcodeDescription')}
|
||||||
/>
|
/>
|
||||||
<GdprCompliant />
|
<GdprCompliant />
|
||||||
<SaveButton />
|
<SaveButton />
|
||||||
|
@@ -11,12 +11,12 @@ export default function ManageSubscription() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Label
|
<Label
|
||||||
title={t`manageSubTitle`}
|
title={t('manageSubTitle')}
|
||||||
description={(
|
description={(
|
||||||
<>
|
<>
|
||||||
{t`manageSubDescription1`}
|
{t('manageSubDescription1')}
|
||||||
<br />
|
<br />
|
||||||
{t`manageSubDescription2`}
|
{t('manageSubDescription2')}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
htmlFor="subscription-manage-page"
|
htmlFor="subscription-manage-page"
|
||||||
@@ -31,13 +31,13 @@ export default function ManageSubscription() {
|
|||||||
linkAutomationId="preview_manage_subscription_page_link"
|
linkAutomationId="preview_manage_subscription_page_link"
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
<label htmlFor="subscription-segments">{t`subscribersCanChooseFrom`}</label>
|
<label htmlFor="subscription-segments">{t('subscribersCanChooseFrom')}</label>
|
||||||
<br />
|
<br />
|
||||||
<SegmentsSelect
|
<SegmentsSelect
|
||||||
id="subscription-segments"
|
id="subscription-segments"
|
||||||
value={segments}
|
value={segments}
|
||||||
setValue={setSegments}
|
setValue={setSegments}
|
||||||
placeholder={t`leaveEmptyToDisplayAll`}
|
placeholder={t('leaveEmptyToDisplayAll')}
|
||||||
/>
|
/>
|
||||||
</Inputs>
|
</Inputs>
|
||||||
</>
|
</>
|
||||||
|
@@ -16,8 +16,8 @@ export default function NewSubscriberNotifications() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Label
|
<Label
|
||||||
title={t`newSubscriberNotifsTitle`}
|
title={t('newSubscriberNotifsTitle')}
|
||||||
description={t`newSubscriberNotifsDescription`}
|
description={t('newSubscriberNotifsDescription')}
|
||||||
htmlFor="subscriber_email_notification-enabled"
|
htmlFor="subscriber_email_notification-enabled"
|
||||||
/>
|
/>
|
||||||
<Inputs>
|
<Inputs>
|
||||||
@@ -27,7 +27,7 @@ export default function NewSubscriberNotifications() {
|
|||||||
value="1"
|
value="1"
|
||||||
onClick={() => setEnabled('1')}
|
onClick={() => setEnabled('1')}
|
||||||
/>
|
/>
|
||||||
{t`yes`}
|
{t('yes')}
|
||||||
{' '}
|
{' '}
|
||||||
<input
|
<input
|
||||||
type="radio"
|
type="radio"
|
||||||
@@ -35,17 +35,17 @@ export default function NewSubscriberNotifications() {
|
|||||||
value=""
|
value=""
|
||||||
onClick={() => setEnabled('')}
|
onClick={() => setEnabled('')}
|
||||||
/>
|
/>
|
||||||
{t`no`}
|
{t('no')}
|
||||||
<br />
|
<br />
|
||||||
<input type="email" value={email} onChange={onChange(setEmail)} placeholder="me@mydomain.com" />
|
<input type="email" value={email} onChange={onChange(setEmail)} placeholder="me@mydomain.com" />
|
||||||
{hasError && (
|
{hasError && (
|
||||||
<div className="mailpoet_error_item mailpoet_error">
|
<div className="mailpoet_error_item mailpoet_error">
|
||||||
{t`pleaseFillEmail`}
|
{t('pleaseFillEmail')}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{invalidEmail && (
|
{invalidEmail && (
|
||||||
<div className="mailpoet_error_item mailpoet_error">
|
<div className="mailpoet_error_item mailpoet_error">
|
||||||
{t`invalidEmail`}
|
{t('invalidEmail')}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Inputs>
|
</Inputs>
|
||||||
|
@@ -36,7 +36,7 @@ export default function Shortcode({ name, title, description }: Props) {
|
|||||||
value={segments}
|
value={segments}
|
||||||
setValue={setSegments}
|
setValue={setSegments}
|
||||||
id={`${name}-shortcode-segments`}
|
id={`${name}-shortcode-segments`}
|
||||||
placeholder={t`leaveEmptyToDisplayAll`}
|
placeholder={t('leaveEmptyToDisplayAll')}
|
||||||
/>
|
/>
|
||||||
</Inputs>
|
</Inputs>
|
||||||
</>
|
</>
|
||||||
|
@@ -19,8 +19,8 @@ export default function StatsNotifications() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Label
|
<Label
|
||||||
title={t`statsNotifsTitle`}
|
title={t('statsNotifsTitle')}
|
||||||
description={t`statsNotifsDescription`}
|
description={t('statsNotifsDescription')}
|
||||||
htmlFor="stats-enabled"
|
htmlFor="stats-enabled"
|
||||||
/>
|
/>
|
||||||
<Inputs>
|
<Inputs>
|
||||||
@@ -30,7 +30,7 @@ export default function StatsNotifications() {
|
|||||||
checked={enabled === '1'}
|
checked={enabled === '1'}
|
||||||
onChange={onToggle(setEnabled)}
|
onChange={onToggle(setEnabled)}
|
||||||
/>
|
/>
|
||||||
<label htmlFor="stats-enabled">{t`newslettersAndPostNotifs`}</label>
|
<label htmlFor="stats-enabled">{t('newslettersAndPostNotifs')}</label>
|
||||||
<br />
|
<br />
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@@ -38,17 +38,17 @@ export default function StatsNotifications() {
|
|||||||
checked={automated === '1'}
|
checked={automated === '1'}
|
||||||
onChange={onToggle(setAutomated)}
|
onChange={onToggle(setAutomated)}
|
||||||
/>
|
/>
|
||||||
<label htmlFor="stats-automated">{t`welcomeAndWcEmails`}</label>
|
<label htmlFor="stats-automated">{t('welcomeAndWcEmails')}</label>
|
||||||
<br />
|
<br />
|
||||||
<input type="email" value={email} onChange={onChange(setEmail)} placeholder="me@mydomain.com" />
|
<input type="email" value={email} onChange={onChange(setEmail)} placeholder="me@mydomain.com" />
|
||||||
{hasError && (
|
{hasError && (
|
||||||
<div className="mailpoet_error_item mailpoet_error">
|
<div className="mailpoet_error_item mailpoet_error">
|
||||||
{t`pleaseFillEmail`}
|
{t('pleaseFillEmail')}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{invalidEmail && (
|
{invalidEmail && (
|
||||||
<div className="mailpoet_error_item mailpoet_error">
|
<div className="mailpoet_error_item mailpoet_error">
|
||||||
{t`invalidEmail`}
|
{t('invalidEmail')}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Inputs>
|
</Inputs>
|
||||||
|
@@ -34,14 +34,14 @@ export default function SubscribeOn({ title, description, event }: Props) {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
className="regular-text"
|
className="regular-text"
|
||||||
value={label || t`yesAddMe`}
|
value={label || t('yesAddMe')}
|
||||||
onChange={onChange(setLabel)}
|
onChange={onChange(setLabel)}
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
<label htmlFor={`subscribe-${event}-segments`}>{t`usersWillBeSubscribedTo`}</label>
|
<label htmlFor={`subscribe-${event}-segments`}>{t('usersWillBeSubscribedTo')}</label>
|
||||||
<br />
|
<br />
|
||||||
<div data-automation-id={`subscribe-${event}-segments-selection`}>
|
<div data-automation-id={`subscribe-${event}-segments-selection`}>
|
||||||
<SegmentsSelect id={`subscribe-${event}-segments`} placeholder={t`chooseList`} value={segments} setValue={setSegments} />
|
<SegmentsSelect id={`subscribe-${event}-segments`} placeholder={t('chooseList')} value={segments} setValue={setSegments} />
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
@@ -8,12 +8,12 @@ export default function UnsubscribePage() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Label
|
<Label
|
||||||
title={t`unsubscribeTitle`}
|
title={t('unsubscribeTitle')}
|
||||||
description={(
|
description={(
|
||||||
<>
|
<>
|
||||||
{t`unsubscribeDescription1`}
|
{t('unsubscribeDescription1')}
|
||||||
<br />
|
<br />
|
||||||
{t`unsubscribeDescription2`}
|
{t('unsubscribeDescription2')}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
htmlFor="subscription-pages-unsubscribe"
|
htmlFor="subscription-pages-unsubscribe"
|
||||||
|
@@ -20,7 +20,7 @@ export default function Settings() {
|
|||||||
<>
|
<>
|
||||||
{isSaving && <Loading />}
|
{isSaving && <Loading />}
|
||||||
<Notices />
|
<Notices />
|
||||||
<h1 className="title">{t`settings`}</h1>
|
<h1 className="title">{t('settings')}</h1>
|
||||||
<Tabs />
|
<Tabs />
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path="/basics" component={Basics} />
|
<Route path="/basics" component={Basics} />
|
||||||
|
Reference in New Issue
Block a user