Add translations
[MAILPOET-1798]
This commit is contained in:
committed by
Jack Kitterhing
parent
7f2f4e0296
commit
43f628e580
@ -23,7 +23,7 @@ function Edit({ attributes, setAttributes }) {
|
|||||||
className="mailpoet-block-create-forms-list"
|
className="mailpoet-block-create-forms-list"
|
||||||
value={attributes.selectedForm}
|
value={attributes.selectedForm}
|
||||||
>
|
>
|
||||||
<option value="" disabled selected>Select a MailPoet form</option>
|
<option value="" disabled selected>{window.locale.selectForm}</option>
|
||||||
{allForms.map((form) => (
|
{allForms.map((form) => (
|
||||||
<option value={form.id}>
|
<option value={form.id}>
|
||||||
{form.name}
|
{form.name}
|
||||||
@ -50,7 +50,7 @@ function Edit({ attributes, setAttributes }) {
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
className="mailpoet-block-create-new-link"
|
className="mailpoet-block-create-new-link"
|
||||||
>
|
>
|
||||||
Create a new form
|
{window.locale.createForm}
|
||||||
</a>
|
</a>
|
||||||
{displayFormsSelect()}
|
{displayFormsSelect()}
|
||||||
</div>
|
</div>
|
||||||
@ -70,7 +70,7 @@ function Edit({ attributes, setAttributes }) {
|
|||||||
<Placeholder
|
<Placeholder
|
||||||
className="mailpoet-block-create-new"
|
className="mailpoet-block-create-new"
|
||||||
icon={<BlockIcon icon={Icon} showColors />}
|
icon={<BlockIcon icon={Icon} showColors />}
|
||||||
label="MailPoet Subscription Form"
|
label={window.locale.subscriptionForm}
|
||||||
>
|
>
|
||||||
{selectFormSettings()}
|
{selectFormSettings()}
|
||||||
</Placeholder>
|
</Placeholder>
|
||||||
|
@ -5,7 +5,7 @@ const wp = window.wp;
|
|||||||
const { registerBlockType } = wp.blocks;
|
const { registerBlockType } = wp.blocks;
|
||||||
|
|
||||||
registerBlockType('mailpoet/form-block', {
|
registerBlockType('mailpoet/form-block', {
|
||||||
title: 'MailPoet Subscription Form',
|
title: window.locale.subscriptionForm,
|
||||||
icon: Icon,
|
icon: Icon,
|
||||||
category: 'widgets',
|
category: 'widgets',
|
||||||
example: {},
|
example: {},
|
||||||
|
@ -73,6 +73,11 @@ class PostEditorBlock {
|
|||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.mailpoet_forms = <?php echo json_encode($forms) ?>;
|
window.mailpoet_forms = <?php echo json_encode($forms) ?>;
|
||||||
|
window.locale = {
|
||||||
|
selectForm: '<?php echo __('Select a MailPoet form', 'mailpoet') ?>',
|
||||||
|
createForm: '<?php echo __('Create a new form', 'mailpoet') ?>',
|
||||||
|
subscriptionForm: '<?php echo __('MailPoet Subscription Form', 'mailpoet') ?>',
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
});
|
});
|
||||||
@ -85,12 +90,12 @@ class PostEditorBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function renderForm($attributes) {
|
public function renderForm($attributes) {
|
||||||
if (!$attributes || !isset($attributes['selectedForm'])) {
|
if (!$attributes || !isset($attributes['form'])) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$basicForm = new Widget();
|
$basicForm = new Widget();
|
||||||
return $basicForm->widget([
|
return $basicForm->widget([
|
||||||
'form' => (int)$attributes['selectedForm'],
|
'form' => (int)$attributes['form'],
|
||||||
'form_type' => 'html',
|
'form_type' => 'html',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user