diff --git a/mailpoet/assets/js/src/common/confirm_alert.jsx b/mailpoet/assets/js/src/common/confirm_alert.jsx index a2b79e916d..1c4828a50f 100644 --- a/mailpoet/assets/js/src/common/confirm_alert.jsx +++ b/mailpoet/assets/js/src/common/confirm_alert.jsx @@ -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) { diff --git a/mailpoet/assets/js/src/listing/bulk_actions.jsx b/mailpoet/assets/js/src/listing/bulk_actions.jsx index ed565929a3..d5c36be91b 100644 --- a/mailpoet/assets/js/src/listing/bulk_actions.jsx +++ b/mailpoet/assets/js/src/listing/bulk_actions.jsx @@ -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" > - {MailPoet.I18n.t('selectBulkAction')} + {__('Select bulk action', 'mailpoet')}
diff --git a/mailpoet/assets/js/src/listing/filters.jsx b/mailpoet/assets/js/src/listing/filters.jsx index 9e68ca867a..8c60f4b87b 100644 --- a/mailpoet/assets/js/src/listing/filters.jsx +++ b/mailpoet/assets/js/src/listing/filters.jsx @@ -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')} ); diff --git a/mailpoet/assets/js/src/listing/header.jsx b/mailpoet/assets/js/src/listing/header.jsx index 565304baf3..d1483d96d4 100644 --- a/mailpoet/assets/js/src/listing/header.jsx +++ b/mailpoet/assets/js/src/listing/header.jsx @@ -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 = ( { if ( @@ -80,7 +79,7 @@ function TutorialIcon(): JSX.Element { }} > - {MailPoet.I18n.t('topBarTutorial')} + {__('Tutorial', 'mailpoet')}
diff --git a/mailpoet/assets/js/src/newsletters/send/congratulate/success_pitch_mss.tsx b/mailpoet/assets/js/src/newsletters/send/congratulate/success_pitch_mss.tsx index f221c2ff76..993f9a52cb 100644 --- a/mailpoet/assets/js/src/newsletters/send/congratulate/success_pitch_mss.tsx +++ b/mailpoet/assets/js/src/newsletters/send/congratulate/success_pitch_mss.tsx @@ -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 { )}

- {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', + )}

- {MailPoet.I18n.t('congratulationsMSSPitchFreeListTitle')}: + {_x( + 'You’ll get', + 'Promotion for our email sending service: Paragraph', + 'mailpoet', + )} + : @@ -98,25 +108,13 @@ export function PitchMss(props: Props): JSX.Element { window.open(props.purchaseUrl); next(); }} - > - {MailPoet.I18n.t('congratulationsMSSPitchFreeButton')} - - diff --git a/mailpoet/assets/js/src/newsletters/send/date_text.jsx b/mailpoet/assets/js/src/newsletters/send/date_text.jsx index 3fa41f15df..8335d92d9f 100644 --- a/mailpoet/assets/js/src/newsletters/send/date_text.jsx +++ b/mailpoet/assets/js/src/newsletters/send/date_text.jsx @@ -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'), diff --git a/mailpoet/assets/js/src/notices/mailer_error.tsx b/mailpoet/assets/js/src/notices/mailer_error.tsx index 7517cf69e4..820b28e755 100644 --- a/mailpoet/assets/js/src/notices/mailer_error.tsx +++ b/mailpoet/assets/js/src/notices/mailer_error.tsx @@ -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 tags with some attributes @@ -202,7 +204,7 @@ export function MailerError({ .catch(() => {}); }} > - {MailPoet.I18n.t('mailerResumeSendingAfterUpgradeButton')} + {__('I have upgraded my subscription, resume sending', 'mailpoet')}

@@ -213,8 +215,14 @@ export function MailerError({

{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', + )} : {message}

{mtaMethod === 'PHPMail' ? ( @@ -233,7 +241,7 @@ export function MailerError({ .catch(() => {}); }} > - {MailPoet.I18n.t('mailerResumeSendingButton')} + {__('Resume sending', 'mailpoet')}

diff --git a/mailpoet/tests/acceptance/Newsletters/DuplicateAutomaticEmailCest.php b/mailpoet/tests/acceptance/Newsletters/DuplicateAutomaticEmailCest.php index 4dc809ee69..837d6cb6e3 100644 --- a/mailpoet/tests/acceptance/Newsletters/DuplicateAutomaticEmailCest.php +++ b/mailpoet/tests/acceptance/Newsletters/DuplicateAutomaticEmailCest.php @@ -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); } } diff --git a/mailpoet/views/layout.html b/mailpoet/views/layout.html index 80772ae487..92adecea20 100644 --- a/mailpoet/views/layout.html +++ b/mailpoet/views/layout.html @@ -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 Reply-to 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 %>