I'm able to translate views titles and menus thanks to config_translation
core module. I would like to have path aliases translated as well but it seems to lack this feature. Any other way to do it?
5 Answers
On my multilingual Drupal 8 sites, I go to /admin/config/search/path/add
for adding URL alias, which asks you to select a language for this alias.
Is this what you were looking for?
-
I was thinking about a configuration kind of solution, aliases are content that I need to reinsert on every site change– AngusCommented Nov 12, 2016 at 10:25
-
3The path that you enter isn't an alias, it is the actual route path, those can not be translated. You need to create aliases in different languages, that's the only way. You could "deploy" it with hook_install and update functions.– BerdirCommented Nov 12, 2016 at 11:21
-
If you are using path prefix for languages, e.g. you want to use
/de/ansicht
for the english/view
, don't add/de
to the path when creating a new alias, even though it's the path you want. You just add/ansicht
.– TimCommented Sep 24, 2017 at 7:02 -
Does the path-alias work with contextual filters? For me it's not working, instead I get a 404 error.– LarSCommented Apr 25, 2021 at 17:59
-
See [How do I translate view's page path alias that has a dynamic path? ](drupal.stackexchange.com/questions/260158/…)– LarSCommented Apr 25, 2021 at 18:13
I was looking exactly for that and finally I contrib with the fixed path alias module, just create the alias for the views page as mentioned before and set it as fixed to be exported into config. The alias will be re-created on the fly when required if not found.
-
This should be considered also as a valid answer since adds the capability to export aliases which is a requirement by the OP– d70rr3sCommented Dec 11, 2019 at 12:43
You can manage your translated aliases with the Pathauto module, which will automatically create a translated URL Alias from the translated node Title. The URL alias will be constructed from a pre-configured Pathauto "Pattern" and will be automatically managed and updated.
-
1While this works for a lot of content, I do not believe this works for Views paths.– firfinCommented Feb 29, 2020 at 14:30
-
Please try drupal.org/project/tvp and see if it helps. I have built this module for similar use case. Commented Apr 4, 2022 at 5:30
I had same issue and I have done this way:
first create view page with alias, for example "alias-test"
then go to admin/config/search/path and click "add alias"
choose language you want to translate, in my case I choose "PT"
on "existing system path" write your path "alias-test" and in "path alias" added alias translation "teste-alias"
This works with language swticher, if you have more than 2 languages you have to repeat this process to all languages you want to translate
-
Does this work with contextual filters? For me it's not working, instead I get an 404 error.– LarSCommented Apr 25, 2021 at 17:57
-
See [How do I translate view's page path alias that has a dynamic path? ](drupal.stackexchange.com/questions/260158/…)– LarSCommented Apr 25, 2021 at 18:14
-
Please try drupal.org/project/tvp and see if it helps. I have built this module for similar use case. Commented Apr 4, 2022 at 5:29
Please try https://www.drupal.org/project/tvp and see if it helps. I have built this module for similar use case.
-
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.– Community BotCommented Apr 4, 2022 at 6:19