Skip to content

Add "Do not translate" and "XML Broken" sections to revcheck - #334

Open
lacatoire wants to merge 3 commits into
php:masterfrom
lacatoire:revcheck/dnt-broken-sections
Open

Add "Do not translate" and "XML Broken" sections to revcheck#334
lacatoire wants to merge 3 commits into
php:masterfrom
lacatoire:revcheck/dnt-broken-sections

Conversation

@lacatoire

@lacatoire lacatoire commented Aug 4, 2026

Copy link
Copy Markdown
Member

Both were already being computed and then dropped: files marked <?do-not-translate?> were detected and skipped without a trace, and libxml errors were collected by XmlUtil then cleared without ever being read. This lists them, in the file summary and in a section of their own.

Telling a real error apart from an unresolved entity was already solved in scripts/broken.php; that logic moves to a shared XmlErrorFilter so both callers follow the same rule. Only the entity files still holding entity declarations are skipped, as those DTD fragments never parse as standalone XML; the .ent files that already are XML are checked like any other.

Files marked do not translate are listed but kept out of the totals, so no translation sees its completion rate drop for files it is not expected to have. The files table gains an xmlError column, so the web report can say what is wrong and not only which file.

An empty file raised a ValueError in XmlUtil::loadText() and aborted the run. It is now reported as any other broken file.

Item "Do not translate and XML Broken sections in revcheck" of #199.

Web side, needed for the statuses to show up on doc.php.net: php/web-doc#68

Checked with php 8.4: scripts/broken.php output unchanged on doc-fr, doc-es, doc-en, doc-ru, doc-de, doc-it and doc-tr; the doc-fr report identical outside the new sections, totals included; XML detection agreeing with broken.php on the same six languages, with the same single finding.

Both were already being computed and then dropped. Files marked
<?do-not-translate?> were detected and skipped without a trace, and
libxml errors were collected by XmlUtil then cleared without ever
being read. They are now listed, in the file summary and in a section
of their own.

Telling a real error apart from an unresolved entity was already
solved in scripts/broken.php. That logic moves to a shared
XmlErrorFilter, so both callers follow the same rule. Entity files
are skipped, as DTD fragments never parse as standalone XML.

Files marked do not translate are listed but kept out of the totals,
otherwise every translation would see its completion rate drop for
files it is not expected to have. The files table gains an xmlError
column, so the web report can say what is wrong, not only which file.

An empty file raised a ValueError in XmlUtil::loadText() and aborted
the run. It is now reported as any other broken file.

@alfsb alfsb 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.

This is impressive work. I will do some tests, and then merge in about a week. Further reviews and comments welcome.

The only comment is about the comment on revtag failing when XML is detected broken. This is true on empty files, but the (almost now extinct) real broken XML files can have valid revtags (as they are text searched) even if XML is misaligned or otherwise invalid.

Comment thread scripts/translation/lib/RevtagParser.php
@alfsb

alfsb commented Aug 6, 2026

Copy link
Copy Markdown
Member

Tested. Detected one change in doc-ru ("Up to date files" + 1), but otherwise ok. Plan to merge this in one week.

Further reviews and comments welcome.

@alfsb alfsb 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.

Difference in doc-ru is a change from TranslatedOk into XmlBroken transition, so it is expected.

Not every .ent is a DTD fragment: entities.acronyms.ent,
entities.remove.ent and entities.extcat.ent parse as standalone
XML, and skipping every non .xml file left them unchecked. Only
the files holding entity declarations are excluded now, so the
exception narrows on its own as those are migrated away.
libxml recovers, so a misaligned file still yields its revtag, and
it is carried over to the report. Only an empty file has none.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants