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

In translated docs, sort glossaries by translated terms #10091

Merged
merged 1 commit into from Jan 12, 2022

Conversation

jeanas
Copy link
Contributor

@jeanas jeanas commented Jan 12, 2022

This is done by moving the sorting from the glossary directive to a
transform operating after the i18n transform.

Closes #9827

Feature or Bugfix

  • Bugfix

Purpose

Translated glossaries were sorted according to alphabetical order of English terms, which makes no sense to a reader of the native language. An example can be found here: https://docs.python.org/fr/3/glossary.html. This sorts them according to translated terms instead. To this end, the glossary directive no longer sorts the entries itself. Instead, it sets a boolean attribute on the glossary node, and a transform happening after the i18n transform takes care of sorting glossaries with this attribute.

This is my first contribution to Sphinx and I'm still new to the code; please let me know if I've missed something.

Relates

#9827

@jeanas
Copy link
Contributor Author

jeanas commented Jan 12, 2022

(CC @Fipaddict @JulienPalard.)

Copy link
Member

@tk0miya tk0miya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with nits.

sphinx/domains/std.py Outdated Show resolved Hide resolved
sphinx/transforms/__init__.py Outdated Show resolved Hide resolved
@jeanas
Copy link
Contributor Author

jeanas commented Jan 12, 2022

Thanks for the review @tk0miya, I'll address your comments soon. Do you have an idea why the CI is failing? All GitHub seems to tell me is just "this check failed" for a bunch of jobs without a log; did I miss it somewhere? Tests pass locally for me.

@jeanas
Copy link
Contributor Author

jeanas commented Jan 12, 2022

Oh, and the "Summaries" are

“GitHub Actions has encountered an internal error when running your job.”

@tk0miya
Copy link
Member

tk0miya commented Jan 12, 2022

Now I restarted CI jobs manually. I hope it goes well.

This is done by moving the sorting from the glossary directive to a
transform operating after the i18n transform.

Closes sphinx-doc#9827
@jeanas
Copy link
Contributor Author

jeanas commented Jan 12, 2022

Yes, it went a lot better. I've pushed an update addressing your comments and fixing flake8 as well as mypy checks.

@tk0miya
Copy link
Member

tk0miya commented Jan 12, 2022

Thank you for your quick update! I'll merge this after CI passed.

@tk0miya tk0miya merged commit 14821a9 into sphinx-doc:4.x Jan 12, 2022
@tk0miya
Copy link
Member

tk0miya commented Jan 12, 2022

Thank you for your contribution!

@jeanas
Copy link
Contributor Author

jeanas commented Jan 12, 2022

Thanks a lot for the review!

tk0miya added a commit that referenced this pull request Jan 12, 2022
@jeanas jeanas deleted the sorted-glossary branch January 12, 2022 16:50
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Glossary :sorted: directive and internationalization.
2 participants