GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-126609: Allow translating the ``availability`` directive by AA-Turner · Pull Request #129549 · python/cpython

Conversation

@AA-Turner

@AA-Turner AA-Turner commented Feb 1, 2025 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: Availability extension's text translation breaks directive rendering #126609

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@AA-Turner
Allow translating the availability directive
8da7fda
@bedevere-app bedevere-app Bot mentioned this pull request Feb 1, 2025
Availability extension's text translation breaks directive rendering #126609
Closed
@m-aciek

m-aciek commented Feb 1, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

I hope I'm not missing anything, but that's what I get:

When I build gettext with % make -e SPHINXOPTS="--write-all" gettext on the branch, I get a full reference statement in the pot file:

#: ../../library/webbrowser.rst:54
msgid ":ref:`Availability <availability>`: not WASI, not Android."
msgstr ""

Then after inserting the translation in po file and building docs:

msgid ":ref:`Availability <availability>`: not WASI, not Android."
msgstr ":ref:`Dostępność <availability>`: nie WASI, nie Android."

It's not being loaded when building html with % make -e SPHINXOPTS="-D language='pl'" html:

Zrzut ekranu 2025-02-1 o 20 09 07

When I add manually to that the Availability word translation, I get the warning in logs and the same effect as on main branch:

Zrzut ekranu 2025-02-1 o 20 11 55
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner

AA-Turner commented Feb 2, 2025

Copy link
Copy Markdown
Member Author

You should definitely not get the :ref: line on this branch as it constructs nodes directly. Could you try make clean or deleting your build folder to clear any caches?

A

m-aciek reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner AA-Turner added docs Documentation in the Doc dir skip news needs backport to 3.12 only security fixes needs backport to 3.13 only security fixes labels Feb 2, 2025
@AA-Turner
AA-Turner marked this pull request as ready for review February 2, 2025 12:59
@AA-Turner
AA-Turner requested a review from hugovk as a code owner February 2, 2025 12:59
@bedevere-app bedevere-app Bot added the awaiting core review label Feb 2, 2025
@AA-Turner

AA-Turner commented Feb 2, 2025

Copy link
Copy Markdown
Member Author

I'm minded to merge this as it fixes a definite oversight in the original PR, and doesn't prevent us merging the revert commit if need be.

A

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@m-aciek

m-aciek commented Feb 2, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Indeed, I've checked wrong file. There's Availability still generated in the POT. Though in html build I still receive broken rendering.

Zrzut ekranu 2025-02-2 o 12 49 02
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner

AA-Turner commented Feb 2, 2025

Copy link
Copy Markdown
Member Author

Though in html build I still receive broken rendering.

Do you still get the [i18n.inconsistent_references] warning?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@m-aciek

m-aciek commented Feb 2, 2025

Copy link
Copy Markdown
Contributor

Do you still get the [i18n.inconsistent_references] warning?

Yes, I do.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner

AA-Turner commented Feb 2, 2025

Copy link
Copy Markdown
Member Author

@m-aciek what are your reproduction steps?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@m-aciek

m-aciek commented Feb 2, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

CPython repository checked out on this branch, symlink at Doc/locales/pl: LC_MESSAGES to a repository with language translations.

% ls -la locales/pl/LC_MESSAGES 
lrwxr-xr-x  1 …  staff  26 Oct 30  2022 locales/pl/LC_MESSAGES -> ../../../../python-docs-pl

Language repository (pl) checked out at 3.13 with a patch applied:

Index: library/webbrowser.po
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/library/webbrowser.po b/library/webbrowser.po
--- a/library/webbrowser.po	(revision 632304c02750bb5b42a49e0f7230981f0285dcb9)
+++ b/library/webbrowser.po	(date 1738506193244)
@@ -88,7 +88,7 @@
 msgstr ""
 
 msgid "Availability"
-msgstr "Availability"
+msgstr "Dostępność"
 
 msgid "The following exception is defined:"
 msgstr ""

Than in CPython repo, Doc directory I run:

% make clean
% make -e SPHINXOPTS="-D language='pl' --write-all" html

In the build output I see bunch of warnings from license.rst and one from webbrowser.rst.

…/projects/cpython/Doc/library/webbrowser.rst:54: WARNING: inconsistent term references in translated message. original: ['Availability'], translated: [] [i18n.inconsistent_references]

And in Doc/build/html/library/webbrowser.html, only "Dostępność" instead of the rendering, as on the screenshot in the previous message.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner

AA-Turner commented Feb 2, 2025

Copy link
Copy Markdown
Member Author

For reference, from a clean check-out of my branch I ran:

PS> cd Doc
PS> python -m sphinx build -M gettext . build -aET
PS> rmdir -Recurse build/gettext/.doctrees
PS> mkdir locales/en_GB/LC_MESSAGES
PS> mv build/gettext/* locales/en_GB/LC_MESSAGES
PS> cd locales
PS> Get-ChildItem -Recurse -Include *.pot | Rename-Item -NewName { $_.Name.replace(".pot",".po") }

Then renaming all instances of

msgid "Availability"
msgstr ""

to

msgid "Availability"
msgstr "AVAILABILITY"

and then

python -m sphinx build -M html . build -aETW --define language=en_GB

With this I get no errors, and the directive renders & links correctly:

image

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner

AA-Turner commented Feb 2, 2025

Copy link
Copy Markdown
Member Author
Index: library/webbrowser.po
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/library/webbrowser.po b/library/webbrowser.po
--- a/library/webbrowser.po	(revision 632304c02750bb5b42a49e0f7230981f0285dcb9)
+++ b/library/webbrowser.po	(date 1738506193244)
@@ -88,7 +88,7 @@
 msgstr ""
 
 msgid "Availability"
-msgstr "Availability"
+msgstr "Dostępność"
 
 msgid "The following exception is defined:"
 msgstr ""

Is there any difference if all instances are replaced instead of just this one?

Than in CPython repo, Doc directory I run:

% make clean
% make -e SPHINXOPTS="-D language='pl' --write-all" html

Please could you try with SPHINXOPTS="-D language='pl' --fresh-env --write-all"?

m-aciek reacted with thumbs up emoji m-aciek reacted with eyes emoji
All reactions
  • 👍 1 reaction
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@m-aciek

m-aciek commented Feb 2, 2025

Copy link
Copy Markdown
Contributor

Is there any difference if all instances are replaced instead of just this one?

I don't think so, just tried with a minimal change.

Please could you try with SPHINXOPTS="-D language='pl' --fresh-env --write-all"?

No difference in the output.

Trying with changing Dostępność to AVAILABILITY, it may match the reference case-insensitively?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@m-aciek

m-aciek commented Feb 2, 2025

Copy link
Copy Markdown
Contributor

Hm, no, that's strange. AVAILABILITY breaks too 🤔 . I've updated all my dependencies recently.

Zrzut ekranu 2025-02-2 o 15 51 02
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner

AA-Turner commented Feb 2, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

@m-aciek I think I've identified the problem -- you need to add a msgid/msgstr pair to sphinx.po. Without it, I get the errors you observe.

I didn't observe the errors as I was rebuilding with gettext from this branch each time, whereas the python-docs-pl clone used the 3.13 branch rather than this branch.

Cloning python-docs-pl and then adding the below to sphinx.po, I get

msgid "Availability"
msgstr "PL-AVAILABILITY"

image

image

m-aciek reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@m-aciek

m-aciek commented Feb 2, 2025

Copy link
Copy Markdown
Contributor

Thank you for reproducing this. Confirming it works indeed, and the reference link works as intended.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

m-aciek
m-aciek approved these changes Feb 2, 2025
View reviewed changes
m-aciek
m-aciek reviewed Feb 2, 2025
View reviewed changes
Comment thread Doc/tools/templates/dummy.html Resolved

Uh oh!

There was an error while loading. Please reload this page.

@m-aciek m-aciek mentioned this pull request Feb 2, 2025
gh-126609: docs: revert changes made to the internal structure of availability directive #129482
Closed
@AA-Turner
typo
691a20d
@AA-Turner
AA-Turner enabled auto-merge (squash) February 2, 2025 16:06
@AA-Turner
AA-Turner merged commit 0612a89 into python:main Feb 2, 2025
@miss-islington-app

miss-islington-app Bot commented Feb 2, 2025

Copy link
Copy Markdown

Thanks @AA-Turner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting core review label Feb 2, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 2, 2025
@AA-Turner @miss-islington
pythongh-126609: Allow translating the availability directive (py…
1397904
…thonGH-129549)

(cherry picked from commit 0612a89)

Co-authored-by: Adam Turner <[email protected]>
@bedevere-app

bedevere-app Bot commented Feb 2, 2025

Copy link
Copy Markdown

GH-129584 is a backport of this pull request to the 3.13 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 2, 2025
@AA-Turner @miss-islington
pythongh-126609: Allow translating the availability directive (py…
fa00f66
…thonGH-129549)

(cherry picked from commit 0612a89)

Co-authored-by: Adam Turner <[email protected]>
@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Feb 2, 2025
@bedevere-app

bedevere-app Bot commented Feb 2, 2025

Copy link
Copy Markdown

GH-129585 is a backport of this pull request to the 3.12 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.12 only security fixes label Feb 2, 2025
AA-Turner added a commit that referenced this pull request Feb 2, 2025
@miss-islington @AA-Turner
[3.12] gh-126609: Allow translating the availability directive (G…
14bd0fc
…H-129549) (#129585)

gh-126609: Allow translating the ``availability`` directive (GH-129549)
(cherry picked from commit 0612a89)

Co-authored-by: Adam Turner <[email protected]>
AA-Turner added a commit that referenced this pull request Feb 3, 2025
@miss-islington @AA-Turner
[3.13] gh-126609: Allow translating the availability directive (G…
9862800
…H-129549) (#129584)

gh-126609: Allow translating the ``availability`` directive (GH-129549)
(cherry picked from commit 0612a89)

Co-authored-by: Adam Turner <[email protected]>
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Feb 7, 2025
@AA-Turner @srinivasreddy
pythongh-126609: Allow translating the availability directive (py…
5fb9143
…thon#129549)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@m-aciek m-aciek m-aciek approved these changes
@hugovk hugovk Awaiting requested review from hugovk hugovk is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

docs Documentation in the Doc dir skip news

Projects

Docs PRs
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@AA-Turner @m-aciek
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.