From 90ebffde4b9b983e752c224966ceb330babdc70f Mon Sep 17 00:00:00 2001 From: Jordi Kroon Date: Wed, 17 Jun 2026 20:47:27 +0200 Subject: [PATCH 1/2] treat IDREF mismatches as warnings in non-English translations --- configure.php | 48 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/configure.php b/configure.php index 8f83848a5f..cb0f254acc 100755 --- a/configure.php +++ b/configure.php @@ -990,14 +990,50 @@ function xml_validate_jing() echo "done.\n"; return; } - else + + // For non-English translations, IDREF mismatches are treated as warnings instead of errors, + // because outdated translations may reference IDs that have yet to be translated from doc-en. + + $isEnglish = $GLOBALS['ac']['LANG'] === 'en'; + $errors = []; + $warnings = []; + + if ( is_array( $out ) ) { - echo "failed.\n"; - if ( is_array( $out ) ) - foreach ( $out as $line ) - echo "$line\n"; - errors_are_bad( 1 ); + foreach ( $out as $line ) + { + if ( !$isEnglish && preg_match( '/IDREF "[^"]+" without matching ID/', $line ) ) + { + $warnings[] = $line; + } + else + { + $errors[] = $line; + } + } } + + if ( count( $warnings ) > 0 ) + { + echo "\n" . count( $warnings ) . " IDREF warning(s) (translation out of sync with doc-en):\n"; + foreach ( $warnings as $line ) + { + echo "$line\n"; + } + } + + if ( count( $errors ) === 0 ) + { + echo "done.\n"; + return; + } + + echo "failed.\n"; + foreach ( $errors as $line ) + { + echo "$line\n"; + } + errors_are_bad( 1 ); } function xml_validate_libxml( $dom ) From de701ba6f3015e882d8cd332b316385d55bcfcba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20L=20F=20S=20Bacci?= Date: Tue, 23 Jun 2026 17:14:32 -0300 Subject: [PATCH 2/2] Show all errors --- configure.php | 53 +++++++++++++-------------------------------------- 1 file changed, 13 insertions(+), 40 deletions(-) diff --git a/configure.php b/configure.php index cb0f254acc..63fc8fc02e 100755 --- a/configure.php +++ b/configure.php @@ -985,55 +985,28 @@ function xml_validate_jing() $cmdJing = "java -jar {$srcdir}/docbook/jing.jar {$schema} {$idempath}"; exec( $cmdJing , $out , $ret ); + if ( ! is_array( $out ) ) + $out = []; + if ( $ret == 0 ) { echo "done.\n"; return; } - // For non-English translations, IDREF mismatches are treated as warnings instead of errors, - // because outdated translations may reference IDs that have yet to be translated from doc-en. + echo "failed.\n"; + foreach ( $out as $line ) + echo "$line\n"; - $isEnglish = $GLOBALS['ac']['LANG'] === 'en'; - $errors = []; - $warnings = []; + // Allow translations with missing/mismatched IDREFs to continue building. - if ( is_array( $out ) ) - { - foreach ( $out as $line ) - { - if ( !$isEnglish && preg_match( '/IDREF "[^"]+" without matching ID/', $line ) ) - { - $warnings[] = $line; - } - else - { - $errors[] = $line; - } - } - } + $countFatal = count( $out ); + foreach ( $out as $line ) + if ( preg_match( '/IDREF "[^"]+" without matching ID/', $line ) ) + $countFatal--; - if ( count( $warnings ) > 0 ) - { - echo "\n" . count( $warnings ) . " IDREF warning(s) (translation out of sync with doc-en):\n"; - foreach ( $warnings as $line ) - { - echo "$line\n"; - } - } - - if ( count( $errors ) === 0 ) - { - echo "done.\n"; - return; - } - - echo "failed.\n"; - foreach ( $errors as $line ) - { - echo "$line\n"; - } - errors_are_bad( 1 ); + if ( $GLOBALS['ac']['LANG'] === 'en' || $countFatal > 0 ) + errors_are_bad( 1 ); } function xml_validate_libxml( $dom )