yari icon indicating copy to clipboard operation
yari copied to clipboard

Page not found with fallback notecard doesn't present language switcher

Open bsmth opened this issue 1 year ago • 0 comments

Summary

If you visit a page with no locale in the URL and have a language preference set (through browser or OS settings), we will 404 the page even though there may be an EN equivalent.

The 404 notecard with a fallback doesn't offer to change languages and persist this preference for future visits.

URL

https://developer.mozilla.org/docs/Mozilla/Firefox/Releases/124

Reproduction steps

  1. Set FR as preferred language in browser preferences
  2. Navigate to https://www.mozilla.org/firefox/124.0/releasenotes/
  3. Scroll to Developer and click Developer Information (links to https://developer.mozilla.org/docs/Mozilla/Firefox/Releases/124 with no locale)

Expected behavior

The notecard with a fallback URL also includes a language switcher to set preferredlocale for site-wide preferences.

Actual behavior

Visiting the https://developer.mozilla.org/docs/Mozilla/Firefox/Releases/124 page will make us land on the FR version with no option to persist language preference.

Additionally, the destination URL (an en-US fallback) exists, but there is no translated version, so we do not offer the language switcher to set future preferences when the visitor lands there.

Device

Desktop

Browser

Firefox

Browser version

Stable

Operating system

Mac OS

Screenshot

No response

Anything else?

Request headers to send back fr equivalent looks like Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3

https://github.com/mdn/yari/blob/6e6ed7873373e35d720922b5924a0537566b4851/client/src/page-not-found/fallback-link.tsx#L95-L112

Validations

bsmth avatar Mar 25 '24 15:03 bsmth