Fix the issue of marketing optin block translation not getting added
Since WP 6.0 we can no longer leave translation_path in block settings empty and expect to receive the fallback thus we need to add the fallback ourselves. [MAILPOET-4435]
This commit is contained in:
@ -86,11 +86,14 @@ class MarketingOptinBlock implements IntegrationInterface {
|
||||
*/
|
||||
private function registerEditorTranslations() {
|
||||
$handle = 'mailpoet-marketing-optin-block-editor-script';
|
||||
$editorTranslations = $this->wp->getWpScripts()->print_translations($handle, false);
|
||||
// mailpoet-marketing-optin-block-editor-script is not enqueued
|
||||
if ($editorTranslations === false) {
|
||||
return;
|
||||
}
|
||||
$editorTranslations = <<<JS
|
||||
( function( domain, translations ) {
|
||||
var localeData = translations.locale_data[ domain ] || translations.locale_data.messages;
|
||||
localeData[""].domain = domain;
|
||||
wp.i18n.setLocaleData( localeData, domain );
|
||||
} )( "mailpoet", { "locale_data": { "messages": { "": {} } } } );
|
||||
JS;
|
||||
|
||||
$translations = [
|
||||
'' => ['domain' => 'messages'],
|
||||
'marketing-opt-in-label' => [__('Marketing opt-in', 'mailpoet')],
|
||||
|
Reference in New Issue
Block a user