2

I'm setting up a multilingual site, and I need the user path aliases to be multilingual.

Users are set up as translatable: User Translation Configuration

Language Detection: URL (path prefix)

  • English: /en
  • Japanese: No prefix

Pathauto patterns:

  • English: /en/users/[user:name]
  • Japanese: '/users/[user:name]

Pathauto Patterns

Example:

  • Username: Admin

Expected paths:

  • English: /en/users/admin
  • Japanese: /users/admin

Actual:

  • English: /en/user/1
  • Main language: /users/admin

I've cleared the registry, regenerated the URLs, manually unset path aliases on the user then checked the box and re-saved, but I have not found any combination that results in multilingual path aliases.]

Update

I've tried the following, which also did not work:

Screenshot of alternate attempt

8
  • 1
    Did you enable "URL detection mehtod" in Admin -> Configuration -> Regional and languages -> Languages -> Detection and selection? Aslo configuration translation and Content language translation module should be installed. Then you can set path auto patterns for each language. URLpattern will be www.youdomain.com/en/yourpattern. But the main language will also have the language code in the URL like /en /de /ru /fr - whatevery your base language is set to. Oct 10, 2021 at 18:04
  • Thank you. I have tried your suggestions, but still no luck. I have updated the post with screenshots and additional information.
    – Jaypan
    Oct 13, 2021 at 9:21
  • Have you tried with the the user original token like users/[user:original:display-name] and checking both the languages[en, jp] in one pattern config. Oct 14, 2021 at 17:43
  • I just tried that (screenshot added to original post), and after deleting and regenerating all User aliases, still no luck. Thank you though.
    – Jaypan
    Oct 14, 2021 at 18:17
  • What exactly do you want to achieve? Show the user detail page on the url users/{some_user} and /en/users/{some_user}? Please correct me if I am wrong.
    – Ales
    Oct 17, 2021 at 19:35

1 Answer 1

1

I followed your setup on a vanilla D9 and can report on the following:

  • Pathauto aliases are created as expected enter image description here but only for translated users enter image description here That is an expected outcome looking at Pathauto's code, since it will start generating language specific aliases based on a pattern only for the translated languages of each entity during bulk updates and only for the active language of an entity during hook_entity_update.
  • A manually created path alias enter image description here for an untranslated language of a user entity does work and resolves properly. enter image description here

In short, the answer is:

Multilingual user aliases are created automatically by Pathauto for each translated language of a user entity, or can be added manually for non-translated languages of a user entity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.