diff --git a/Plugin/AdminhtmlCmsBeforeSavePlugin.php b/Plugin/AdminhtmlCmsBeforeSavePlugin.php index 2b07e95..519e125 100644 --- a/Plugin/AdminhtmlCmsBeforeSavePlugin.php +++ b/Plugin/AdminhtmlCmsBeforeSavePlugin.php @@ -53,7 +53,7 @@ public function beforeExecute(mixed $subject): ?array $destinationLanguage ); - if ($attributeCode === 'url_key') { + if ($attributeCode === 'identifier') { $requestPostValue[$attributeCode] = strtolower( preg_replace('#[^0-9a-z]+#i', '-', $requestPostValue[$attributeCode]) ); diff --git a/Service/TranslateParsedContent.php b/Service/TranslateParsedContent.php index 8bb9a61..35077ed 100644 --- a/Service/TranslateParsedContent.php +++ b/Service/TranslateParsedContent.php @@ -43,7 +43,23 @@ public function execute( string $destinationLanguage ): mixed { if (is_string($parsedContent)) { - return $this->translateWidgetDirectives($parsedContent, $destinationLanguage); + [$text, $widgetMap] = $this->extractPlaceholders( + $parsedContent, + self::WIDGET_PATTERN, + 'WIDGET_PLACEHOLDER_' + ); + + $text = $this->translator->translate($text, $destinationLanguage); + + foreach ($widgetMap as $key => $widget) { + $text = str_replace( + $key, + $this->translateWidgetParams($widget, $destinationLanguage), + $text + ); + } + + return $text; } $contentSettingsMap = []; diff --git a/view/adminhtml/layout/cms_page_edit.xml b/view/adminhtml/layout/cms_page_edit.xml index fc8c1c9..77f0fae 100644 --- a/view/adminhtml/layout/cms_page_edit.xml +++ b/view/adminhtml/layout/cms_page_edit.xml @@ -20,6 +20,7 @@ Meta Title Meta Keywords Meta Description + URL Key