-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: translation not running when set to sync #29
base: main
Are you sure you want to change the base?
Conversation
fine by reading |
I need to take a closer look at this case. If a language is configured to sync from another language, then nodes would automatically be adopted, without having to switch the language in the dimension switcher and hit “create and copy”. |
Not sure what you mean. Do you mean when creating a new dimension preset the whole tree should be created? Because that isn't the case. I created a command (in a separate package) that clones the whole node tree based on given dimensions and target dimensions and in that case the whole tree gets created, but without this fix nothing gets translated. |
Sorry for the late reply. If the configuration is set to sync, then the nodes are adopted/synced automatically as soon as the node in the source language is changed and published. But I don't know right now how it behaves if you change the configuration later when there is already content. E.g., you add another language dimension. For that case, I wrote a sync command which can sync the whole content tree for a language. However, I did not publish it yet. I think this would be the better approach, wouldn't it? Say like you add another language dimension, and then you run the command to have a fully synchronized new language dimension. Your PR is not wrong, though, but it would require doing the creation process through the language switcher for every document. What do you mean? |
No problem.
Somehow we had issues with this, which might be due to our setup (multiple dimensions - country & language). Adding a new dimension set definitely did not work and I created a command to sync from one set to another set - I guess similar as you. Mine looks like this: public function syncTree(string $siteNodeName, array $from, array $to): void
{
$from = json_decode(reset($from), true);
$targetDimensions = json_decode(reset($to), true);
/** @var Context $context */
$context = $this->getContext('live', $from);
$siteNode = $context->getNode('/sites/' . $siteNodeName);
if (!$siteNode) {
$this->output->outputLine('The sitenode could not be found, please check if you have the correct siteNodeName and if the from dimensions are available in your configuration.');
$this->quit();
}
$documentNodeQuery = new FlowQuery([$siteNode]);
$documentNodeQuery->pushOperation('find', ['[instanceof Neos.Neos:Document]']);
$documentNodes = $documentNodeQuery->get();
array_unshift($documentNodes, $siteNode);
$this->output->outputLine('Found %s document nodes', [sizeof($documentNodes)]);
$this->output->progressStart(sizeof($documentNodes));
$newContext = $this->getContext('live', $targetDimensions);
/** @var NodeInterface $documentNode */
foreach ($documentNodes as $documentNode) {
$newContext->adoptNode($documentNode, true);
$this->nodeDataRepository->persistEntities();
$this->output->progressAdvance();
}
$this->output->progressFinish();
$this->quit();
} |
Fixes #28