Closed (duplicate)
Project:
Pathauto
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Apr 2020 at 20:37 UTC
Updated:
10 Feb 2026 at 09:54 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
waspper commentedComment #3
waspper commentedComment #5
malte.koelle commentedPatch #2 looks good to me, besides the fact that the tests are failing.
I found this issue #2923672: Aliases not generated for users on one language. Could this possibly be a duplicate?
Comment #6
waspper commentedI agree @malte.koelle. They're same issue. But I think (IMHO) we should manage it here, because this patch should work for any entity. And there, they're talking about just users. Anyway, let's allow them to decide :)
Comment #7
berdirThere are several language related and overlapping issues with recent activity atm. Please help to unify that by closing things as duplicates and combining patches.
Keep in mind that:
a) There are long-standing issues open in drupal core that are related to the path alias widget and language handling. My argument so far was always that the behavior of pathauto should be consistent with manually created aliases and I don't really plan to change that.
b) Any change will not only need to pass the existing tests but also have additional test coverage for the new use case.
Comment #8
vflirt commentedIt seems that the languages selector on the pattern is misunderstood. As far as I understand it we can set a specific pattern for specific language which would require the alias field first to be translatable meaning when the node is in French (or for the French translation of the source node) we can have different pattern. If no languages are selected then this pattern is applied to all translations and this is the how it currently works.
CreateAlias calls $pattern = $this->getPatternByEntity($entity); which loads pattern based on conditions. All I tested works correct.
From what I see as the patch and thinking here is that the created alias would be with language not specified which is not how pathauto and core work by default. I suggest we close this issue as working as designed. If path alias is needed for language not specified which is what I also need than you should look for https://www.drupal.org/project/drupal/issues/2689459 that fixes core issue for manually entered urls and I suggest we work on a patch in https://www.drupal.org/project/pathauto/issues/3069519 as it describes exactly that issue in pathauto.
If you small amount of content you can manually change the language of the generated aliases but in my cases there could be thousands of nodes so not really easy.
Comment #10
benjifisherFor the project I am working on, I have already applied the core patch from #2689459: If you don't want to translate your URL alias, the original URL alias won't work with your translations. I would like Pathauto to be consistent. I always think twice before going against @Berdir's advice, but in this case I think the arguments in #7 do not apply for this site.
If I understand correctly, the point of #8 is that we should check whether the alias is set to be translated, as well as the configured languages for the pattern, before using language neutral. I think that is correct, but that condition is satisfied for my site.
I looked at the test failures from #2. If I read it correctly, the failure is when an alias is manually edited, then the node is set to use the Pathauto pattern. I tried that manually, and it worked as expected. That needs further investigation.
The patch in #2 is pretty simple, but I think it is a little simpler to use
array_filter()instead ofarray_reduce(). I have created an issue fork with the original patch and then changing that.Comment #12
rteijeiro commentedI used the solution described in #2946354: Alias not using language undefined when alias is not translatable as it seems core patch in #2689459 is not working for automatically generated url aliases. Will keep it as a temporary solution until core is fixed.
Referenced other related issues.
Comment #13
mably commentedLet's close this as a duplicate of #2946354.