Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flyout language selector doesn't show current language after upgrading to RTD Theme 3.0.0 #1621

Closed
Hyrla opened this issue Oct 14, 2024 · 3 comments · Fixed by #1629
Closed
Assignees
Labels
Accepted Accepted issue on our roadmap Bug A bug

Comments

@Hyrla
Copy link

Hyrla commented Oct 14, 2024

Problem

I am not sure if this issue is related to RTD Theme or new addon system. Right now, flyout language selector doesn't show current language. Before upgrading to 3.0.0 (I was using 2.0.0), all language choices were shown.

Reproducible Project

Project documentation: https://esieabot.readthedocs.io/en/latest/
Project documentation conf.py file: https://gitlab.esiea.fr/esieabot/esieabot-docs/rtd/-/blob/main/docs/source/conf.py

Error Logs/Results

image

image

Expected Results

Is there a way to display all available languages (including the one that is currently used) like before? On my screenshots, I only see French option when I am reading in English. In French version, I can only see English version.

Environment Info

  • Python Version: 3.12
  • Sphinx Version: 8.3.1
  • RTD Theme Version: latest (3.0.1)
@Hyrla Hyrla added Bug A bug Needed: replication Bug replication is required labels Oct 14, 2024
@humitos
Copy link
Member

humitos commented Oct 14, 2024

Thanks for reporting this. It seems a bug in this chunk of code:

function renderLanguages(config) {
if (!config.projects.translations.length) {
return "";
}
const languagesHTML = `
<dl>
<dt>{{ _('Languages') }}</dt>
${config.projects.translations
.map(
(translation) => `
<dd ${translation.slug == config.projects.current.slug ? 'class="rtd-current-item"' : ""}>
<a href="${translation.urls.documentation}">${translation.language.code}</a>
</dd>
`,
)
.join("\n")}
</dl>
`;
return languagesHTML;
}

It should be injecting this.config.projects.current, similar to what CPython's code is doing: https://github.com/python/cpython/blob/67f6e08147bc005e460d82fcce85bf5d56009cf5/Doc/tools/static/rtd_switcher.js#L23-L25

I forgot to do that when I migrated that work here.

@humitos humitos added Accepted Accepted issue on our roadmap and removed Needed: replication Bug replication is required labels Oct 14, 2024
@github-project-automation github-project-automation bot moved this to Planned in 📍Roadmap Oct 14, 2024
@humitos humitos self-assigned this Oct 14, 2024
humitos added a commit that referenced this issue Nov 11, 2024
@humitos humitos moved this from In progress to Needs review in 📍Roadmap Nov 11, 2024
@github-project-automation github-project-automation bot moved this from Needs review to Done in 📍Roadmap Nov 13, 2024
@humitos
Copy link
Member

humitos commented Nov 13, 2024

I just released v3.0.2 that includes this fix. Please let us know if it works as expected.

@Hyrla
Copy link
Author

Hyrla commented Nov 13, 2024

I just released v3.0.2 that includes this fix. Please let us know if it works as expected.

Yes issue has been fixed, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Accepted issue on our roadmap Bug A bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants