◐ Shell
reader mode source ↗
Skip to content

gh-126609: localize list, allow translation of a phrase, use ge operator character in the availability directive#129597

Closed
m-aciek wants to merge 7 commits into
python:mainfrom
m-aciek:docs/availability-translation-not
Closed

gh-126609: localize list, allow translation of a phrase, use ge operator character in the availability directive#129597
m-aciek wants to merge 7 commits into
python:mainfrom
m-aciek:docs/availability-translation-not

Conversation

@m-aciek

@m-aciek m-aciek commented Feb 2, 2025

Copy link
Copy Markdown
Contributor
  1. Localizes platform support lists using Babel's format_list().
  2. Exposes translation phrase not {platform} and fetches its translation in the availability directive content. This will allow full translations of availability directive content.
  3. Renders text-based greater-than or equal-to sing >= as UTF-8 .

Tested locally, both make gettext (exposes new phrase in sphinx.pot) and rendering with make html. Examples of renderings:

library/os.rst:2311

  • original:
Zrzut ekranu 2025-02-3 o 11 47 58
  • Traditional Chinese:
Zrzut ekranu 2025-02-3 o 12 06 24
  • Polish:
Zrzut ekranu 2025-02-3 o 12 06 35

📚 Documentation preview 📚: https://cpython-previews--129597.org.readthedocs.build/

@m-aciek m-aciek changed the title Docs: allow translation of a phrase in the availability directive Feb 2, 2025
@m-aciek m-aciek changed the title Docs: allow translation of a phrase in the availability directive, use ge operator character Feb 2, 2025
@AA-Turner AA-Turner changed the title Docs: allow translation of a phrase, use ge operator character in the availability directive Feb 2, 2025
@m-aciek m-aciek changed the title gh-126609: allow translation of a phrase, use ge operator character in the availability directive Feb 3, 2025

@StanFromIreland StanFromIreland left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hide comment

Other than my little nitpick it looks very good!

m-aciek and others added 2 commits February 3, 2025 22:40
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
@AA-Turner

Copy link
Copy Markdown
Member

It would be good to properly investigate why the gettext builder is not picking up the raw text here. In the other part of #126609, there was a fairly simple resolution instead of a partial revert -- the PR as it stands now is duplicative, parsing and re-creating the text provided to the directive, whereas currently we just validate that it is correct. If we fix the source text being picked up by gettext, it would also mean that we don't need babel.lists, as translators can simply translate the source text naturally. As such, I've added the DO-NOT-MERGE label for the time being.

A

@m-aciek m-aciek marked this pull request as draft February 4, 2025 14:26
@m-aciek

m-aciek commented Feb 19, 2025

Copy link
Copy Markdown
Contributor Author

I'm convinced that we should translate the full text, instead of building it from fragments (vide Prefer WET over DRY for i18n). Therefore I will close this PR. I didn't yet succeed with the correct solution. I will try to write my findings in related discussion thread soon https://github.com/orgs/sphinx-doc/discussions/13280.

@m-aciek m-aciek closed this Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants