diff --git a/Classes/ContentRepository/NodeTranslationService.php b/Classes/ContentRepository/NodeTranslationService.php
index 2988b12..ccd8012 100644
--- a/Classes/ContentRepository/NodeTranslationService.php
+++ b/Classes/ContentRepository/NodeTranslationService.php
@@ -4,12 +4,12 @@
namespace Sitegeist\LostInTranslation\ContentRepository;
-use InvalidArgumentException;
use Neos\ContentRepository\Domain\Model\NodeInterface;
use Neos\ContentRepository\Domain\Model\Workspace;
use Neos\ContentRepository\Domain\Repository\NodeDataRepository;
use Neos\ContentRepository\Domain\Service\Context;
use Neos\ContentRepository\Domain\Service\ContextFactory;
+use Neos\ContentRepository\Exception\NodeException;
use Neos\Flow\Annotations as Flow;
use Neos\Neos\Service\PublishingService;
use Neos\Neos\Utility\NodeUriPathSegmentGenerator;
@@ -155,9 +155,17 @@ public function afterNodePublish(NodeInterface $node, Workspace $workspace): voi
* @param NodeInterface $targetNode
* @param Context $context
* @return void
+ * @throws NodeException
*/
public function translateNode(NodeInterface $sourceNode, NodeInterface $targetNode, Context $context): void
{
+ if (
+ $targetNode->hasProperty('preventTranslation') && $targetNode->getProperty('preventTranslation') === true ||
+ $targetNode->getParent() && $targetNode->getParent()->hasProperty('preventTranslation') && $targetNode->getParent()->getProperty('preventTranslation') === true
+ ) {
+ return;
+ }
+
$propertyDefinitions = $sourceNode->getNodeType()->getProperties();
$sourceDimensionValue = $sourceNode->getContext()->getTargetDimensions()[$this->languageDimensionName];
@@ -286,6 +294,14 @@ public function syncNode(NodeInterface $sourceNode, string $workspaceName = 'liv
$context = $this->getContextForLanguageDimensionAndWorkspaceName($presetIdentifier, $workspaceName);
$context->getFirstLevelNodeCache()->flush();
+ // If the parent element (i.e. a content collection) has preventTranslations on, make sure we do not sync changes - and translations
+ if ($sourceNode->getParent()) {
+ $parentTargetNode = $context->adoptNode($sourceNode->getParent());
+ if ($parentTargetNode && $parentTargetNode->hasProperty('preventTranslation') && $parentTargetNode->getProperty('preventTranslation') === true) {
+ continue;
+ }
+ }
+
$targetNode = $context->adoptNode($sourceNode);
// Move node if targetNode has no parent or node parents are not matching
diff --git a/Configuration/NodeTypes.yaml b/Configuration/NodeTypes.yaml
index a404ccc..56269b8 100644
--- a/Configuration/NodeTypes.yaml
+++ b/Configuration/NodeTypes.yaml
@@ -16,5 +16,3 @@
metaKeywords:
options:
automaticTranslation: true
-
-
diff --git a/Configuration/Settings.Neos.yaml b/Configuration/Settings.Neos.yaml
index 349363a..a6a2f16 100644
--- a/Configuration/Settings.Neos.yaml
+++ b/Configuration/Settings.Neos.yaml
@@ -2,3 +2,9 @@ Neos:
Fusion:
defaultContext:
'Sitegeist.LostInTranslation': 'Sitegeist\LostInTranslation\Eel\TranslationHelper'
+ Neos:
+ userInterface:
+ translation:
+ autoInclude:
+ 'Sitegeist.LostInTranslation':
+ - '*'
diff --git a/NodeTypes/Mixin/TranslationMeta.yaml b/NodeTypes/Mixin/TranslationMeta.yaml
new file mode 100644
index 0000000..77ecae0
--- /dev/null
+++ b/NodeTypes/Mixin/TranslationMeta.yaml
@@ -0,0 +1,17 @@
+'Sitegeist.LostInTranslation:Mixin.TranslationMeta':
+ abstract: true
+ ui:
+ inspector:
+ groups:
+ translation:
+ label: i18n
+ icon: 'icon-globe'
+ properties:
+ preventTranslation:
+ type: boolean
+ ui:
+ label: i18n
+ help:
+ message: i18n
+ inspector:
+ group: translation
diff --git a/README.md b/README.md
index 69db9bb..182f073 100644
--- a/README.md
+++ b/README.md
@@ -180,6 +180,11 @@ Sitegeist:
- 'Hamburg'
```
+### Ignoring Nodes (when in sync-mode)
+Optionally you can use the `Sitegeist.LostInTranslation:Mixin.TranslationMeta` mixin in your node configuration to
+enable the option to prevent the translation to be changed when sync mode is active, but you would like to exclude
+a specific node (or container element).
+
## Eel Helper
The package also provides two Eel helper to translate texts in Fusion.
diff --git a/Resources/Private/Translations/de/NodeTypes/Mixin/TranslationMeta.xlf b/Resources/Private/Translations/de/NodeTypes/Mixin/TranslationMeta.xlf
new file mode 100644
index 0000000..22f666a
--- /dev/null
+++ b/Resources/Private/Translations/de/NodeTypes/Mixin/TranslationMeta.xlf
@@ -0,0 +1,15 @@
+
+
+
+
+
+ Prevent automatic sync & translation
+ Automatische Synchronisierung & Übersetzung verhindern
+
+
+ When set, this node (and children) will not be automatically synced and translated even when sync is enabled.
+ Wenn diese Option gesetzt ist, wird diese Node (und die untergeordneten Nodes) nicht automatisch synchronisiert und übersetzt, selbst wenn die Synchronisierung aktiviert ist.
+
+
+
+
diff --git a/Resources/Private/Translations/en/NodeTypes/Mixin/TranslationMeta.xlf b/Resources/Private/Translations/en/NodeTypes/Mixin/TranslationMeta.xlf
new file mode 100644
index 0000000..efcd6be
--- /dev/null
+++ b/Resources/Private/Translations/en/NodeTypes/Mixin/TranslationMeta.xlf
@@ -0,0 +1,16 @@
+
+
+
+
+
+ Translation options
+
+
+ Prevent automatic sync & translation
+
+
+ When set, this node (and children) will not be automatically synced and translated even when sync is enabled.
+
+
+
+