Quantcast
Viewing all articles
Browse latest Browse all 293522

If you don't want to translate your URL alias, the original URL alias won't work with your translations

Problem/Motivation

If you don't want to translate your URL alias, the original URL alias won't work with your translations.

Steps to reproduce:
Per #171

1. Enable content translation and language detection based on URL and add the Spanish language.
2. Enable all the article translation options except URL.
3. Enable Pathauto with the default path for articles.
4. Create an English article with the title of Hello and the automatic path of example.com/hello
5. Translate the English article to Spanish with a title of Hola. Do not change the path.

The Spanish article should have a path of example.com/es/hello

In fact, the Spanish article will have a path of example.com/es/hola thus translating the path even though URL is supposed to be untranslated.

to work around this, the editor can manually set the url on the spanish translation back to /hello thus setting the URL back to example.com/es/hello. But, if the automatic URL is used, the url is translated based on the spanish title rather than using the untranslated english path.

Also, before an article is translated, untranslated nodes loaded in Spanish can get a path example.com/es/node/1 instead of example.com/es/hello

  1. Install with standard
  2. Enable Language and Content Translation modules.
  3. Add a language (e.g. Spanish)
    • /admin/config/regional/language
  4. Edit Article content type, Language settings > Enable translation
    • /admin/structure/types/manage/article
  5. Go to content translation settings and check Content. Within Article, uncheck the URL alias field.
    • /admin/config/regional/content-language
  6. Create an Article, assign an URL alias in the form (e.g. /my-alias)
  7. Translate the node. The URL alias is prepopulated with your source alias (e.g. /my-alias).
  8. Submit the form.

Current outcome:
In the alias list (/admin/config/search/path), you have (/my-alias, EN).
Going to /es/my-alias gives a 404.

Expected outcome:
In the alias list, you should have (/my-alias, UND).
Going to /es/my-alias gives a 200 and displays the Spanish translation.

Proposed resolution

  • If the entity OR the path field are not translatable, save the path alias with the langcode 'und'.
  • If the entity AND the path field are translatable, save the path alias with the langcode of the entity (or translation).

Remaining tasks

  • Agree on proposed resolution
  • Review

User interface changes

None.

API changes

None.

Data model changes

None.


Viewing all articles
Browse latest Browse all 293522

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>