Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
- Set a custom error page node at
/admin/config/system/site-information
for English. - Translate (with 'Content translation' in Core) this node to German.
- Set the translated node as the custom error page node for German (with the help of i18n multilingual variables at
/admin/config/regional/i18n/variable
) - Now visit a 404 triggering page: works as expected, the wrong URL is active
- Now switch to the other language with the language switcher: the real error page node URL is active, not the 404 triggering page
Expected behaviour: keep the wrong URL active, when you visit a translated error page (but switch the language prefix, of course).
Example:
You try to visit /en/node/42
, which is not existent → 404 error.
You switch to the German error page → it should have the URL /de/node/42
, and not the path of the error page itself (/404
for example).
(that is the way the default error page works, if you set no custom error page)
Comments
Comment #1
naxoc CreditAttribution: naxoc commentedI verified that the bug exists, but it is not Drupal core that is responisble for the localized variables, so I'm moving this to i18n.
Comment #2
Jose Reyero CreditAttribution: Jose Reyero commentedI don't think this is a bug, though it may be more of a philosophical discussion. But once you provide a link from a page it doesn't make sense it is also a 404 itself.
*It should be a valid page because it is a link you provided from your site*
If any, it is a Drupal core issue because it is Drupal core 'who' decides the language switcher link for a 'page not found' is the translation of the node you used in the first place. Having multilingual variables enabled doesn't really change that.
I would call a bug the fact that Drupal core blindly links en/wrongpath to es/wrongpath and even printing links on your page that lead to a 'page not found'.
Anyway if you want a workaround for your 'expected behavior', set different page not found paths that are not translations of each other or use some custom block to switch these links.
Comment #2.0
Jose Reyero CreditAttribution: Jose Reyero commentedadded clarification of the default error page behaviour