Detect missing translation files and report progress in validate_translation.py#1266
Open
abdeltaehass wants to merge 1 commit into
Open
Detect missing translation files and report progress in validate_translation.py#1266abdeltaehass wants to merge 1 commit into
abdeltaehass wants to merge 1 commit into
Conversation
validate_translation.py only diffed section names from _toctree.yml, so a section that was listed in the table of contents but had no .mdx file on disk went unnoticed even though it breaks the doc-builder build. It also read section["local"] directly, skipping local_fw (PyTorch/TensorFlow) sections. - check that every section in a language's _toctree.yml has a matching .mdx file, and exit non-zero when one is missing so it can gate CI - handle local_fw sections so framework-specific files are counted - print a progress summary (translated/total sections and percentage) - fix "sesions" typo in the output
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this does
Improves
utils/validate_translation.pyso it does more than diff section names between a translation's_toctree.ymland the English source._toctree.ymlis now checked for a matching.mdxfile. A section that is listed but has no file breaks thedoc-builderbuild (as the README warns), but the old script never caught it. The script now exits non-zero in that case, so it can be used as a CI gate.local_fwsections. The previous code readsection["local"]directly, silently ignoring framework-specific entries such aschapter8/4_tf. Both PyTorch and TensorFlow variants are now counted.Why
While checking translation status I noticed the script can report a translation as having "no missing sections" even when an entry in
_toctree.ymlpoints to a file that doesn't exist — which then fails the build. The on-disk check closes that gap, and the progress summary makes it easier to see how far a translation has come.Before / After
Before:
After:
When a section is listed in
_toctree.ymlbut its file is missing:Testing
ar,fr,en) — progress percentages and missing-section lists are correct.python -m black --check utils/validate_translation.pypasses.cc @lewtun @stevhliu