sphinx_rtd_theme icon indicating copy to clipboard operation
sphinx_rtd_theme copied to clipboard

Language switching redirects to home page instead of the current page's translation

Open Hyrla opened this issue 1 year ago • 4 comments

Problem

Since migrating to Sphinx RTD Theme 3.0, switching language redirects the user to the doc's home page instead of displaying the current page's translation. This used to work properly on 2.0.

Reproducible Project

Example page: https://esieabot.readthedocs.io/fr/latest/assemble/esieabot/esieabot-2024/esieabot-2024.html (the issue is the same with every page)

Expected Results

I am expecting to display current page's translation when switching language, like it used to be. Is there a new setting to mitigate that?

Environment Info

  • Python Version: 3.12
  • Sphinx Version: 8.3.1
  • RTD Theme Version: latest (3.0.1)

Hyrla avatar Nov 08 '24 07:11 Hyrla

Isn't this issue a duplicated of https://github.com/readthedocs/sphinx_rtd_theme/issues/1621?

humitos avatar Nov 08 '24 11:11 humitos

Isn't this issue a duplicated of #1621?

I am sorry if my issue is not clear. It is a different issue here. Previously, if I switched language while I am reading a page in French, I was redirected to the same page in English (it's the same URL, but /fr/ was replaced by /en/). With the last version, switching language redirects to the home page instead of the current page translated in another language.

Hyrla avatar Nov 08 '24 11:11 Hyrla

Gotcha, thanks for the extra details.

It seems we will need to replicate the chunk of code we added to addons that reads the readthedocs-resolver-filename META tag and appends it to the link:

https://github.com/readthedocs/addons/blob/0f025e3bf604f96506aebf2af120b4c20d02fde8/src/utils.js#L211-L241

humitos avatar Nov 11 '24 15:11 humitos

Thank you. Do you need any more details?

Hyrla avatar Nov 11 '24 17:11 Hyrla