My site has English as language by default, "French" as other language. Modules "Path" and "locale" are enabled but "content translation" is disabled. The contributed "internationalization" module is not enabled. Nodes are of very simple user-defined types, consisting in a title and a body. According to the "Content" list, all pages are in French, English being only there in case a future administrator need it as administrator interface language.
Aliases language is French. They are defined but don't work, producing the message "Page non trouvée" ("Page not found"). If I change the alias language from French to "tout" ("all"), then they work.

Expected behaviour: since the URL aliases and the pages language is the same, the URL aliases should work.

Comments

neRok’s picture

Version: 7.17 » 7.x-dev
Component: path.module » language.module
Priority: Normal » Major

Marked #1977946: Search results' link should use the node's language to get the alias as duplicate of this issue.

Also going to bump the priority up, as it seems this could seriously affect end-users.

neRok’s picture

David_Rothstein’s picture

Status: Active » Postponed (maintainer needs more info)

What are the exact steps to reproduce this, and what do the URLs of the "page not found" page look like?

Does it happen on Drupal 8 also?

I have tried to reproduce this but haven't figured out how. I made French the default language and created some content (in order to get the node language and URL alias language French). Then I switched the default language back to English. This made the original URL aliases no longer active since they were in the wrong language (so that clicking on the older content from the content administration page just went to /node/1, /node/2, etc directly), and it all worked with no "page not found" errors.

russellb’s picture

Issue summary: View changes

I'm seeing non default language URL aliases giving 'Page not found' as follows:

- Existing Drupal 7.41 site
- English is the default language
- Locale and content translation enabled
- French language added
- Create a node in English - give it a url alias eg. 'test/en1'
- Translation the node into French - give it a url alias eg. 'test/fr1'
- Attempt to browse to the French URL alias - 'Page not found'.

russellb’s picture

I've done some debug, and the problem that I'm having seems to be that at line 77 of path.inc a decision is made that we must be looking for an English URL as a fallback to default because no language infix has been found in the url.

I did indeed have URL detection switched off. It seems like perhaps multilingual URL aliases only work if URL language detection is switched on (in admin/config/regional/language/configure).

Many sites will not want to use language infixes, or domain language switching, so it does feel to me that there may be an issue here.

David_Rothstein’s picture

Thanks for the details. I can reproduce it now, but yes:

I did indeed have URL detection switched off. It seems like perhaps multilingual URL aliases only work if URL language detection is switched on (in admin/config/regional/language/configure).

Once URL language detection is turned on, then the French URL alias in your example does work at /fr/test/fr1.

I can see the confusion, but not sure if this can be changed now since other things depend on it. For example, we don't have any restriction on unique URL aliases across languages, so nothing currently stops someone from creating 'my-alias' in English and then using 'my-alias' in French. That works because the language prefix in the URL keeps the two separate.

I think this might be the same issue as #347265: URL aliases not working for content not in default language.

russellb’s picture

Yes agreed. I think infact I'm starting to recall Gábor talking about this in a Drupalcon presentation at some point...

If there´s anything we could take forward from this perhaps it might be a way of greying out the URL alias entry field or somesuch when it´s just not going to work because of language negotiation settings, or even just some help text on the language negotiation config form.

I´m guessing though that as translation sets are out of fashion in D8 this could bubble back under...

David_Rothstein’s picture

Title: URL aliases of non default language for nodes of that non default language don't work » URL aliases of non default language for nodes of that non default language don't work when URL language detection is disabled
Status: Postponed (maintainer needs more info) » Active

If there´s anything we could take forward from this perhaps it might be a way of greying out the URL alias entry field or somesuch when it´s just not going to work because of language negotiation settings, or even just some help text on the language negotiation config form.

That definitely seems worth considering, yes.