Closed glogiotatidis closed 3 years ago
Netlify supports redirects based on Country or Locale. https://docs.netlify.com/routing/redirects/redirect-options/#redirect-by-country-or-language
We are blocked on this waiting for Pocket to get back to us on how l10n happens.
Quoting Mark's very detailed reply:
Locale identification works by using Express' req.acceptsLanguages() Method to read the request's Accept-Language header and compare this list against a list of supported languages. The default language is English (en) if there are no matches between supported and accepted languages. Here is where you can find the files that are controlling this:
Detecting languages middleware Handling the language matching and redirect middleware Setting the language after redirect middleware List of routes that are localized Supported languages list
One thing to note here is that the Pocket Hits Signup page was built before the web-discover repo had proper localization setup. So, it uses a custom Middleware that appends a custom header to assist the page in determining the correct language to display. There are only two languages supported for this page (en and de-DE). You can find relevant files to this here:
Appending "x-pocket-lang" custom header middleware Single route using this method Where the this header is read Supported languages list
@glogiotatidis what's next here?
Also:
/firefox
redirects to/pocket-and-firefox
. Which side will be responsible for those redirects?