Skip to content

Commit

Permalink
Fix issue with newsletter form fields not getting translated
Browse files Browse the repository at this point in the history
[MAILPOET-4908]
  • Loading branch information
samnajian committed Mar 9, 2023
1 parent 9e55eea commit db2d95e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
7 changes: 5 additions & 2 deletions mailpoet/assets/js/src/common/form/textarea/textarea.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TextareaHTMLAttributes } from 'react';
import { __ } from '@wordpress/i18n';
import classnames from 'classnames';
import { Tooltip } from 'common/tooltip/tooltip';

Expand Down Expand Up @@ -29,7 +30,9 @@ export function Textarea({
>
<textarea className={classnames({ code: isCode })} {...attributes} />
{customLabel && (
<div className="mailpoet-form-input-label">{customLabel}</div>
<div className="mailpoet-form-input-label">
{__(customLabel, 'mailpoet')}
</div>
)}
{tooltip && (
<>
Expand All @@ -41,7 +44,7 @@ export function Textarea({
/>
</span>
<Tooltip place="right" multiline id={attributes.name}>
{tooltip}
{__(tooltip, 'mailpoet')}
</Tooltip>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function SenderEmailAddressWarning({
{ReactStringReplace(
__(
'Email violates Sender Domain’s DMARC policy. Please set up [link]sender authentication[/link].',
'mailpoet',
),
/\[link](.*?)\[\/link]/g,
(match) => (
Expand Down
8 changes: 4 additions & 4 deletions mailpoet/assets/js/src/form/fields/selection.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createRef, Component } from 'react';
import { Component, createRef } from 'react';
import jQuery from 'jquery';
import _ from 'underscore';
import 'react-dom';
Expand Down Expand Up @@ -125,11 +125,11 @@ class Selection extends Component {
const templateRendered = (option) => {
let tpl = '';
if (option.tag) {
tpl += `<span class="mailpoet-form-select2-tag">${option.tag}</span>`;
tpl += `<span class='mailpoet-form-select2-tag'>${option.tag}</span>`;
}
tpl += `<span class="mailpoet-form-select2-text"><span>${option.text}</span></span>`;
tpl += `<span class='mailpoet-form-select2-text'><span>${option.text}</span></span>`;
if (option.count) {
tpl += `<span class="mailpoet-form-select2-count">${option.count}</span>`;
tpl += `<span class='mailpoet-form-select2-count'>${option.count}</span>`;
}
return tpl;
};
Expand Down
3 changes: 2 additions & 1 deletion mailpoet/assets/js/src/form/form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import PropTypes from 'prop-types';

import { MailPoet } from 'mailpoet';
import { FormField } from 'form/fields/field.jsx';
import { Button } from 'common';
import { Button, registerTranslations } from 'common';

registerTranslations();
class FormComponent extends Component {
constructor(props) {
super(props);
Expand Down
1 change: 0 additions & 1 deletion mailpoet/views/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@
'refreshMyEmailVolumeLimit': __('I’ve upgraded my subscription, refresh monthly email limit'),

'manageSenderDomainHeaderSubtitle': __('To help your audience and MailPoet authenticate you as the domain owner, please add the following DNS records to your domain’s DNS and click “Verify the DNS records”. Please note that it may take up to 24 hours for DNS changes to propagate after you make the change. [link]Read the guide[/link].', 'mailpoet'),
'authorizeSenderDomain': __('Email violates Sender Domain’s DMARC policy. Please set up [link]sender authentication[/link].'),

'reviewRequestHeading': _x('Thank you! Time to tell the world?', 'After a user gives us positive feedback via the NPS poll, we ask them to review our plugin on WordPress.org.'),
'reviewRequestDidYouKnow': __('[username], did you know that hundreds of WordPress users read the reviews on the plugin repository? They’re also a source of inspiration for our team.'),
Expand Down
2 changes: 0 additions & 2 deletions mailpoet/views/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@
'readGuide': __('Read our guide'),

'invalidEmail': __('Invalid email address'),
'youNeedToAuthorizeTheEmail': __('Not an authorized sender email address. [link]Authorize it now.[/link]'),
'authorizeMyEmail': __('Authorize my email address'),
'authorizeSenderDomain': __('Email violates Sender Domain’s DMARC policy. Please set up [link]sender authentication[/link].'),

'enableSignupConfTitle': __('Enable sign-up confirmation'),
'enableSignupConfDescription': __("If you enable this option, your subscribers will first receive a confirmation email after they subscribe. Once they confirm their subscription (via this email), they will be marked as 'confirmed' and will begin to receive your email newsletters."),
Expand Down

0 comments on commit db2d95e

Please sign in to comment.