0
votes

I'm using the TMGMT Drupal 8 module to export XLF files with content to translate. When I import the translated file, the XLF provider is set to "Auto accept finished translations", so the translation is automatically saved and published.

The problem is, when an original node is not set to automated alias, the process of saving the translation doesn't generate a new alias too.

I would like to force translation to use automated alias on save, but I don't see how to do it actually. If anyone has a suggestion it would be nice.

Thanks in advance.

2

2 Answers

0
votes

Ok, if anyone is interested, I do it with the following hook :

function mymodule_entity_translation_create(EntityInterface $translation) {
    if (isset($translation->path, $translation->path->pathauto)) {
        $translation->path->pathauto = PathautoState::CREATE;
    }
}

?>

the hook_entity_translation_create is invoked when a new translation is initialized. I set $translation->path->pathauto to PathautoState::CREATE to force the creation of a new automatized alias.

Hope it can help.

0
votes

Better yet, this has already has an active issue, and a patch. Pathauto should be taking care of this for us.

Aliases are not created for affected translations