-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Allow reordered refs and translated display text in pending_xref #14144
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
Merged
AA-Turner
merged 5 commits into
sphinx-doc:master
from
mattwang44:refine-compare-references-method
Dec 4, 2025
+99
−5
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
89f8b79
fix(i18n): Allow reordered refs and translated display text in pendin…
mattwang44 be9dc10
Apply suggestions from code review
AA-Turner d458349
Apply suggestions from code review
mattwang44 a26591d
Merge remote-tracking branch 'origin/master' into refine-compare-refe…
mattwang44 91d6c41
Add CHANGES entry for i18n reference comparison fix
mattwang44 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ CONTENTS | |
| topic | ||
| markup | ||
| backslashes | ||
| refs_reordered | ||
|
|
||
| .. toctree:: | ||
| :maxdepth: 2 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| :tocdepth: 2 | ||
|
|
||
| i18n with reordered and translated references | ||
| ============================================== | ||
|
|
||
| .. glossary:: | ||
|
|
||
| term one | ||
| First glossary term | ||
|
|
||
| term two | ||
| Second glossary term | ||
|
|
||
| 1. Multiple refs reordered: :term:`term one` and :term:`term two`. | ||
|
|
||
| 2. Single ref with translated display text: :term:`term one`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Test for reordered and translated references. | ||
| # These should NOT trigger inconsistency warnings. | ||
| # | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: sphinx 1.0\n" | ||
| "Report-Msgid-Bugs-To: \n" | ||
| "POT-Creation-Date: 2024-01-01 00:00+0000\n" | ||
| "PO-Revision-Date: 2024-01-01 00:00+0000\n" | ||
| "Last-Translator: Test\n" | ||
| "Language-Team: xx\n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: 8bit\n" | ||
|
|
||
| msgid "i18n with reordered and translated references" | ||
| msgstr "I18N WITH REORDERED AND TRANSLATED REFERENCES" | ||
|
|
||
| msgid "First glossary term" | ||
| msgstr "FIRST GLOSSARY TERM" | ||
|
|
||
| msgid "Second glossary term" | ||
| msgstr "SECOND GLOSSARY TERM" | ||
|
|
||
| # Reordered references - should NOT warn because targets are the same | ||
| msgid "Multiple refs reordered: :term:`term one` and :term:`term two`." | ||
| msgstr "MULTIPLE REFS REORDERED: :term:`term two` AND :term:`term one`." | ||
|
|
||
| # Translated display text - should NOT warn because reftarget is the same | ||
| msgid "Single ref with translated display text: :term:`term one`." | ||
| msgstr "SINGLE REF WITH TRANSLATED DISPLAY TEXT: :term:`TRANSLATED TERM ONE <term one>`." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should any of the other
compare_references()calls haveignore_order=True?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I'm not pretty sure.
I only applied it to
update_pending_xrefs()since this would slash all those building warnings regarding sequence issue from the pydoc-zh-tw project, but I believe making it the default behavior (and removeignore_order) should be safe. Either making it default behavior or stay as it is and applyignore_order=Trueon demand both fine for me. What do you think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattwang44 are translators able to re-order any of the other ones?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i believe so, but chances are rare.