Use wp/i18n in components that's used for newsletter app
[MAILPOET-4908]
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import { MailPoet } from 'mailpoet';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import PropTypes from 'prop-types';
|
||||
import ReactDOMServer from 'react-dom/server';
|
||||
|
||||
import { MailPoet } from 'mailpoet';
|
||||
|
||||
function ConfirmAlert(props) {
|
||||
MailPoet.Modal.popup({
|
||||
title: props.title,
|
||||
@@ -49,9 +51,9 @@ ConfirmAlert.propTypes = {
|
||||
};
|
||||
|
||||
ConfirmAlert.defaultProps = {
|
||||
title: MailPoet.I18n.t('confirmTitle'),
|
||||
cancelLabel: MailPoet.I18n.t('cancelLabel'),
|
||||
confirmLabel: MailPoet.I18n.t('confirmLabel'),
|
||||
title: __('Confirm to proceed', 'mailpoet'),
|
||||
cancelLabel: __('Cancel', 'mailpoet'),
|
||||
confirmLabel: __('Confirm', 'mailpoet'),
|
||||
};
|
||||
|
||||
export function confirmAlert(props) {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { Component } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
|
||||
import { MailPoet } from 'mailpoet';
|
||||
import PropTypes from 'prop-types';
|
||||
import { withBoundary } from '../common';
|
||||
|
||||
@@ -79,7 +79,7 @@ class ListingBulkActions extends Component {
|
||||
data-automation-id="listing-bulk-actions"
|
||||
>
|
||||
<span className="screen-reader-text">
|
||||
{MailPoet.I18n.t('selectBulkAction')}
|
||||
{__('Select bulk action', 'mailpoet')}
|
||||
</span>
|
||||
|
||||
<div>
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { Component } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import jQuery from 'jquery';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { Button } from 'common/button/button.tsx';
|
||||
import { MailPoet } from 'mailpoet';
|
||||
import { Select } from 'common/form/select/select.tsx';
|
||||
import { withBoundary } from '../common';
|
||||
|
||||
@@ -74,7 +74,7 @@ class ListingFilters extends Component {
|
||||
onClick={this.handleEmptyTrash}
|
||||
automationId="empty_trash"
|
||||
>
|
||||
{MailPoet.I18n.t('emptyTrash')}
|
||||
{__('Empty Trash', 'mailpoet')}
|
||||
</Button>
|
||||
</span>
|
||||
);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
|
||||
import { Checkbox } from 'common/form/checkbox/checkbox.tsx';
|
||||
import { MailPoet } from 'mailpoet';
|
||||
import { ListingColumn } from './listing_column.jsx';
|
||||
|
||||
class ListingHeader extends Component {
|
||||
@@ -37,7 +37,7 @@ class ListingHeader extends Component {
|
||||
checkbox = (
|
||||
<th className="manage-column column-cb mailpoet-listing-check-column">
|
||||
<label className="screen-reader-text" htmlFor="select_all">
|
||||
{MailPoet.I18n.t('selectAll')}
|
||||
{__('Select All', 'mailpoet')}
|
||||
</label>
|
||||
<Checkbox
|
||||
name="select_all"
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import jQuery from 'jquery';
|
||||
import { Component } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import _ from 'underscore';
|
||||
import classnames from 'classnames';
|
||||
import PropTypes from 'prop-types';
|
||||
@@ -579,12 +580,12 @@ class ListingComponent extends Component {
|
||||
bulkActions = [
|
||||
{
|
||||
name: 'restore',
|
||||
label: MailPoet.I18n.t('restore'),
|
||||
label: __('Restore', 'mailpoet'),
|
||||
onSuccess: this.props.messages.onRestore,
|
||||
},
|
||||
{
|
||||
name: 'delete',
|
||||
label: MailPoet.I18n.t('deletePermanently'),
|
||||
label: __('Delete permanently', 'mailpoet'),
|
||||
onSuccess: this.props.messages.onDelete,
|
||||
},
|
||||
];
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { ReactNode } from 'react';
|
||||
import { Location } from 'history';
|
||||
import { MailPoet } from 'mailpoet';
|
||||
import { Icon, video } from '@wordpress/icons';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { HideScreenOptions } from '../../common/hide_screen_options/hide_screen_options';
|
||||
@@ -67,7 +66,7 @@ function TutorialIcon(): JSX.Element {
|
||||
role="button"
|
||||
onClick={displayTutorial}
|
||||
className="mailpoet-top-bar-beamer"
|
||||
title={MailPoet.I18n.t('topBarTutorial')}
|
||||
title={__('Tutorial', 'mailpoet')}
|
||||
tabIndex={0}
|
||||
onKeyDown={(event) => {
|
||||
if (
|
||||
@@ -80,7 +79,7 @@ function TutorialIcon(): JSX.Element {
|
||||
}}
|
||||
>
|
||||
<Icon icon={video} />
|
||||
<span>{MailPoet.I18n.t('topBarTutorial')}</span>
|
||||
<span>{__('Tutorial', 'mailpoet')}</span>
|
||||
</a>
|
||||
<span id="beamer-empty-element" />
|
||||
</div>
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { __, _x } from '@wordpress/i18n';
|
||||
import { useState } from 'react';
|
||||
import { MailPoet } from 'mailpoet';
|
||||
import ReactStringReplace from 'react-string-replace';
|
||||
|
||||
import { WelcomeWizardStepLayoutBody } from 'wizard/layout/step_layout_body.jsx';
|
||||
@@ -63,14 +62,25 @@ export function PitchMss(props: Props): JSX.Element {
|
||||
)}
|
||||
</Heading>
|
||||
<p>
|
||||
{MailPoet.I18n.t(
|
||||
props.subscribersCount < 1000
|
||||
? 'congratulationsMSSPitchFreeSubtitle'
|
||||
: 'congratulationsMSSPitchNotFreeSubtitle',
|
||||
)}
|
||||
{props.subscribersCount < 1000
|
||||
? _x(
|
||||
'Did you know? Users with 1,000 subscribers or less get the Starter plan for free.',
|
||||
'Promotion for our email sending service: Paragraph',
|
||||
'mailpoet',
|
||||
)
|
||||
: _x(
|
||||
'Starting at only $10 per month, MailPoet Business offers the following features',
|
||||
'Promotion for our email sending service: Paragraph',
|
||||
'mailpoet',
|
||||
)}
|
||||
</p>
|
||||
<Heading level={5}>
|
||||
{MailPoet.I18n.t('congratulationsMSSPitchFreeListTitle')}:
|
||||
{_x(
|
||||
'You’ll get',
|
||||
'Promotion for our email sending service: Paragraph',
|
||||
'mailpoet',
|
||||
)}
|
||||
:
|
||||
</Heading>
|
||||
<FreeBenefitsList />
|
||||
|
||||
@@ -98,25 +108,13 @@ export function PitchMss(props: Props): JSX.Element {
|
||||
window.open(props.purchaseUrl);
|
||||
next();
|
||||
}}
|
||||
>
|
||||
{MailPoet.I18n.t('congratulationsMSSPitchFreeButton')}
|
||||
</Button>
|
||||
<Button
|
||||
isFullWidth
|
||||
variant="tertiary"
|
||||
onClick={next}
|
||||
onKeyDown={(event) => {
|
||||
if (
|
||||
['keydown', 'keypress'].includes(event.type) &&
|
||||
['Enter', ' '].includes(event.key)
|
||||
) {
|
||||
event.preventDefault();
|
||||
next();
|
||||
}
|
||||
}}
|
||||
withSpinner={isClosing}
|
||||
>
|
||||
{MailPoet.I18n.t('congratulationsMSSPitchNoThanks')}
|
||||
{_x(
|
||||
'Sign up for free',
|
||||
'Promotion for our email sending service: Button',
|
||||
'mailpoet',
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</WelcomeWizardStepLayoutBody>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { Component } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { __, _x } from '@wordpress/i18n';
|
||||
import PropTypes from 'prop-types';
|
||||
import { registerLocale } from 'react-datepicker';
|
||||
import locale from 'date-fns/locale/en-US';
|
||||
@@ -10,53 +10,53 @@ import { MailPoet } from 'mailpoet';
|
||||
|
||||
const monthValues = {
|
||||
abbreviated: [
|
||||
MailPoet.I18n.t('januaryShort'),
|
||||
MailPoet.I18n.t('februaryShort'),
|
||||
MailPoet.I18n.t('marchShort'),
|
||||
MailPoet.I18n.t('aprilShort'),
|
||||
MailPoet.I18n.t('mayShort'),
|
||||
MailPoet.I18n.t('juneShort'),
|
||||
MailPoet.I18n.t('julyShort'),
|
||||
MailPoet.I18n.t('augustShort'),
|
||||
MailPoet.I18n.t('septemberShort'),
|
||||
MailPoet.I18n.t('octoberShort'),
|
||||
MailPoet.I18n.t('novemberShort'),
|
||||
MailPoet.I18n.t('decemberShort'),
|
||||
__('Jan', 'mailpoet'),
|
||||
__('Feb', 'mailpoet'),
|
||||
__('Mar', 'mailpoet'),
|
||||
__('Apr', 'mailpoet'),
|
||||
__('May', 'mailpoet'),
|
||||
__('Jun', 'mailpoet'),
|
||||
__('Jul', 'mailpoet'),
|
||||
__('Aug', 'mailpoet'),
|
||||
__('Sep', 'mailpoet'),
|
||||
__('Oct', 'mailpoet'),
|
||||
__('Nov', 'mailpoet'),
|
||||
__('Dec', 'mailpoet'),
|
||||
],
|
||||
wide: [
|
||||
MailPoet.I18n.t('january'),
|
||||
MailPoet.I18n.t('february'),
|
||||
MailPoet.I18n.t('march'),
|
||||
MailPoet.I18n.t('april'),
|
||||
MailPoet.I18n.t('may'),
|
||||
MailPoet.I18n.t('june'),
|
||||
MailPoet.I18n.t('july'),
|
||||
MailPoet.I18n.t('august'),
|
||||
MailPoet.I18n.t('september'),
|
||||
MailPoet.I18n.t('october'),
|
||||
MailPoet.I18n.t('november'),
|
||||
MailPoet.I18n.t('december'),
|
||||
__('January', 'mailpoet'),
|
||||
__('February', 'mailpoet'),
|
||||
__('March', 'mailpoet'),
|
||||
__('April', 'mailpoet'),
|
||||
__('May', 'mailpoet'),
|
||||
__('June', 'mailpoet'),
|
||||
__('July', 'mailpoet'),
|
||||
__('August', 'mailpoet'),
|
||||
__('September', 'mailpoet'),
|
||||
__('October', 'mailpoet'),
|
||||
__('November', 'mailpoet'),
|
||||
__('December', 'mailpoet'),
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: [
|
||||
MailPoet.I18n.t('sundayMin'),
|
||||
MailPoet.I18n.t('mondayMin'),
|
||||
MailPoet.I18n.t('tuesdayMin'),
|
||||
MailPoet.I18n.t('wednesdayMin'),
|
||||
MailPoet.I18n.t('thursdayMin'),
|
||||
MailPoet.I18n.t('fridayMin'),
|
||||
MailPoet.I18n.t('saturdayMin'),
|
||||
_x('S', 'Sunday - one letter abbreviation', 'mailpoet'),
|
||||
_x('M', 'Monday - one letter abbreviation', 'mailpoet'),
|
||||
_x('T', 'Tuesday - one letter abbreviation', 'mailpoet'),
|
||||
_x('W', 'Wednesday - one letter abbreviation', 'mailpoet'),
|
||||
_x('T', 'Thursday - one letter abbreviation', 'mailpoet'),
|
||||
_x('F', 'Friday - one letter abbreviation', 'mailpoet'),
|
||||
_x('S', 'Saturday - one letter abbreviation', 'mailpoet'),
|
||||
],
|
||||
abbreviated: [
|
||||
MailPoet.I18n.t('sundayShort'),
|
||||
MailPoet.I18n.t('mondayShort'),
|
||||
MailPoet.I18n.t('tuesdayShort'),
|
||||
MailPoet.I18n.t('wednesdayShort'),
|
||||
MailPoet.I18n.t('thursdayShort'),
|
||||
MailPoet.I18n.t('fridayShort'),
|
||||
MailPoet.I18n.t('saturdayShort'),
|
||||
__('Sun', 'mailpoet'),
|
||||
__('Mon', 'mailpoet'),
|
||||
__('Tue', 'mailpoet'),
|
||||
__('Wed', 'mailpoet'),
|
||||
__('Thu', 'mailpoet'),
|
||||
__('Fri', 'mailpoet'),
|
||||
__('Sat', 'mailpoet'),
|
||||
],
|
||||
wide: [
|
||||
__('Sunday', 'mailpoet'),
|
||||
|
@@ -1,8 +1,10 @@
|
||||
import { ReactNodeArray, useState } from 'react';
|
||||
import { MailPoet } from 'mailpoet';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import ReactStringReplace from 'react-string-replace';
|
||||
import classnames from 'classnames';
|
||||
|
||||
import { MailPoet } from 'mailpoet';
|
||||
|
||||
const resumeMailerSending = () =>
|
||||
MailPoet.Ajax.post({
|
||||
api_version: window.mailpoet_api_version,
|
||||
@@ -10,7 +12,7 @@ const resumeMailerSending = () =>
|
||||
action: 'resumeSending',
|
||||
})
|
||||
.done(() => {
|
||||
MailPoet.Notice.success(MailPoet.I18n.t('mailerSendingResumedNotice'));
|
||||
MailPoet.Notice.success(__('Sending has been resumed.', 'mailpoet'));
|
||||
if (window.mailpoet_listing) {
|
||||
window.mailpoet_listing.forceUpdate();
|
||||
}
|
||||
@@ -124,7 +126,7 @@ export function MailerError({
|
||||
});
|
||||
if (code) {
|
||||
message += message ? ', ' : '';
|
||||
message += MailPoet.I18n.t('mailerErrorCode').replace('%1$s', code);
|
||||
message += __('Error code: %1$s', 'mailpoet').replace('%1$s', code);
|
||||
}
|
||||
|
||||
// allow <a> tags with some attributes
|
||||
@@ -202,7 +204,7 @@ export function MailerError({
|
||||
.catch(() => {});
|
||||
}}
|
||||
>
|
||||
{MailPoet.I18n.t('mailerResumeSendingAfterUpgradeButton')}
|
||||
{__('I have upgraded my subscription, resume sending', 'mailpoet')}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
@@ -213,8 +215,14 @@ export function MailerError({
|
||||
<div className={className}>
|
||||
<p>
|
||||
{mtaLog.error.operation === 'send'
|
||||
? MailPoet.I18n.t('mailerSendErrorNotice').replace('%1$s', mtaMethod)
|
||||
: MailPoet.I18n.t('mailerConnectionErrorNotice')}
|
||||
? __(
|
||||
'Sending has been paused due to a technical issue with %1$s',
|
||||
'mailpoet',
|
||||
).replace('%1$s', mtaMethod)
|
||||
: __(
|
||||
'Sending is paused because the following connection issue prevents MailPoet from delivering emails',
|
||||
'mailpoet',
|
||||
)}
|
||||
: <i>{message}</i>
|
||||
</p>
|
||||
{mtaMethod === 'PHPMail' ? (
|
||||
@@ -233,7 +241,7 @@ export function MailerError({
|
||||
.catch(() => {});
|
||||
}}
|
||||
>
|
||||
{MailPoet.I18n.t('mailerResumeSendingButton')}
|
||||
{__('Resume sending', 'mailpoet')}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
@@ -22,6 +22,6 @@ class DuplicateAutomaticEmailCest {
|
||||
$i->waitForText('Email "Copy of ' . $emailSubject . '" has been duplicated.', 20);
|
||||
$i->waitForListingItemsToLoad();
|
||||
$i->clickItemRowActionByItemName('Copy of ' . $emailSubject, 'Edit');
|
||||
$i->waitForElement('[data-automation-id="newsletter_title"]', 20);
|
||||
$i->waitForElement('[data-automation-id="newsletter_title"]', 50);
|
||||
}
|
||||
}
|
||||
|
@@ -127,7 +127,6 @@ jQuery('#adminmenu #toplevel_page_mailpoet-newsletters')
|
||||
<%= localize({
|
||||
'topBarLogoTitle': __('Back to section root'),
|
||||
'topBarUpdates': __('Updates'),
|
||||
'topBarTutorial': __('Tutorial'),
|
||||
'whatsNew': __("What’s new"),
|
||||
'updateMailPoetNotice': __('[link]Update MailPoet[/link] to see the latest changes'),
|
||||
'ajaxFailedErrorMessage': __('An error has happened while performing a request, the server has responded with response code %d'),
|
||||
@@ -135,7 +134,6 @@ jQuery('#adminmenu #toplevel_page_mailpoet-newsletters')
|
||||
'senderEmailAddressWarning1': _x('You might not reach the inbox of your subscribers if you use this email address.', 'In the last step, before sending a newsletter. URL: ?page=mailpoet-newsletters#/send/2'),
|
||||
'senderEmailAddressWarning2': _x('Use an address like %1$s for the Sender and put %2$s in the <em>Reply-to</em> field below.', 'In the last step, before sending a newsletter. URL: ?page=mailpoet-newsletters#/send/2'),
|
||||
'senderEmailAddressWarning3': _x('Read more.'),
|
||||
'mailerSendingResumedNotice': __('Sending has been resumed.'),
|
||||
'mailerSendingNotResumedUnauthorized': __('Failed to resume sending because the email address is unauthorized. Please authorize it and try again.'),
|
||||
'dismissNotice': __('Dismiss this notice.'),
|
||||
|
||||
@@ -214,44 +212,6 @@ jQuery('#adminmenu #toplevel_page_mailpoet-newsletters')
|
||||
|
||||
'close': __('Close'),
|
||||
'today': __('Today'),
|
||||
'january': __('January'),
|
||||
'february': __('February'),
|
||||
'march': __('March'),
|
||||
'april': __('April'),
|
||||
'may': __('May'),
|
||||
'june': __('June'),
|
||||
'july': __('July'),
|
||||
'august': __('August'),
|
||||
'september': __('September'),
|
||||
'october': __('October'),
|
||||
'november': __('November'),
|
||||
'december': __('December'),
|
||||
'januaryShort': __('Jan'),
|
||||
'februaryShort': __('Feb'),
|
||||
'marchShort': __('Mar'),
|
||||
'aprilShort': __('Apr'),
|
||||
'mayShort': __('May'),
|
||||
'juneShort': __('Jun'),
|
||||
'julyShort': __('Jul'),
|
||||
'augustShort': __('Aug'),
|
||||
'septemberShort': __('Sep'),
|
||||
'octoberShort': __('Oct'),
|
||||
'novemberShort': __('Nov'),
|
||||
'decemberShort': __('Dec'),
|
||||
'sundayShort': __('Sun'),
|
||||
'mondayShort': __('Mon'),
|
||||
'tuesdayShort': __('Tue'),
|
||||
'wednesdayShort': __('Wed'),
|
||||
'thursdayShort': __('Thu'),
|
||||
'fridayShort': __('Fri'),
|
||||
'saturdayShort': __('Sat'),
|
||||
'sundayMin': _x('S', 'Sunday - one letter abbreviation'),
|
||||
'mondayMin': _x('M', 'Monday - one letter abbreviation'),
|
||||
'tuesdayMin': _x('T', 'Tuesday - one letter abbreviation'),
|
||||
'wednesdayMin': _x('W', 'Wednesday - one letter abbreviation'),
|
||||
'thursdayMin': _x('T', 'Thursday - one letter abbreviation'),
|
||||
'fridayMin': _x('F', 'Friday - one letter abbreviation'),
|
||||
'saturdayMin': _x('S', 'Saturday - one letter abbreviation'),
|
||||
}) %>
|
||||
<% block translations %><% endblock %>
|
||||
|
||||
|
Reference in New Issue
Block a user