- Issue created by @ksenzee
If you use a language-neutral alias for a node, it confuses \Drupal\soft_translations\SoftTranslationsManager::getSoftTranslations() into thinking that node is translated into every language on the site.
I’m not 100% sure of these repro steps. They should work, but last I checked there were still some core bugs around language-neutral aliases.
1. Set up multilingual site, English as default language, plus German, Spanish, and French.
2. Create node 1 in English with no alias.
3. Create a language-neutral (langcode und) URL alias for the node, at /test-node. The node is now reachable in English via /test-node.
4. Create node 2, in German, with the alias /test-node.
5. The soft translations table at node/2/translations should have one row, representing the English node/1, but it will have three copies of that identical row.
What happens is that SoftTranslationsManager::getSoftTranslations() uses \Drupal\path_alias\AliasManager::getPathByAlias() as a way of determining which languages have content available at /test-node, and the existence of a language-neutral alias means that calling getPathByAlias('/test-node', $langcode) will succeed no matter what langcode gets passed.
I’m filing the issue without a patch because I’m not sure what the right fix is. Using aliases as the detection mechanism seems like the right architecture—that’s what determines whether a soft translation exists at all—but it’s insufficient when there are language-neutral aliases. Maybe it should look up the entire alias, not just the path, and check the langcode field to see whether the alias being returned is language-neutral, and if so, fall back on checking the node itself for available translations in that language? That’s more heavyweight than using aliases but I can’t think of another way to do it correctly.
Active
1.0
Code