Skip to content

Commit 3eca0c5

Browse files
committed
treat IDREF mismatches as warnings in non-English translations
1 parent 59621bf commit 3eca0c5

1 file changed

Lines changed: 40 additions & 6 deletions

File tree

configure.php

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -990,14 +990,48 @@ function xml_validate_jing()
990990
echo "done.\n";
991991
return;
992992
}
993-
else
993+
994+
// For non-English translations, IDREF mismatches are treated as warnings instead of errors,
995+
// because outdated translations may reference IDs that have yet to be translated from doc-en.
996+
997+
$isEnglish = $GLOBALS['ac']['LANG'] === 'en';
998+
$errors = [];
999+
$warnings = [];
1000+
1001+
if ( is_array( $out ) )
9941002
{
995-
echo "failed.\n";
996-
if ( is_array( $out ) )
997-
foreach ( $out as $line )
998-
echo "$line\n";
999-
errors_are_bad( 1 );
1003+
foreach ( $out as $line )
1004+
{
1005+
if ( !$isEnglish && preg_match( '/IDREF "[^"]+" without matching ID/', $line ) )
1006+
{
1007+
$warnings[] = $line;
1008+
} else {
1009+
$errors[] = $line;
1010+
}
1011+
}
10001012
}
1013+
1014+
if ( count( $warnings ) > 0 )
1015+
{
1016+
echo "\n" . count( $warnings ) . " IDREF warning(s) (translation out of sync with doc-en):\n";
1017+
foreach ( $warnings as $line )
1018+
{
1019+
echo "$line\n";
1020+
}
1021+
}
1022+
1023+
if ( count( $errors ) === 0 )
1024+
{
1025+
echo "done.\n";
1026+
return;
1027+
}
1028+
1029+
echo "failed.\n";
1030+
foreach ( $errors as $line )
1031+
{
1032+
echo "$line\n";
1033+
}
1034+
errors_are_bad( 1 );
10011035
}
10021036

10031037
function xml_validate_libxml( $dom )

0 commit comments

Comments
 (0)