File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -990,14 +990,50 @@ 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+ }
1009+ else
1010+ {
1011+ $ errors [] = $ line ;
1012+ }
1013+ }
10001014 }
1015+
1016+ if ( count ( $ warnings ) > 0 )
1017+ {
1018+ echo "\n" . count ( $ warnings ) . " IDREF warning(s) (translation out of sync with doc-en): \n" ;
1019+ foreach ( $ warnings as $ line )
1020+ {
1021+ echo "$ line \n" ;
1022+ }
1023+ }
1024+
1025+ if ( count ( $ errors ) === 0 )
1026+ {
1027+ echo "done. \n" ;
1028+ return ;
1029+ }
1030+
1031+ echo "failed. \n" ;
1032+ foreach ( $ errors as $ line )
1033+ {
1034+ echo "$ line \n" ;
1035+ }
1036+ errors_are_bad ( 1 );
10011037}
10021038
10031039function xml_validate_libxml ( $ dom )
You can’t perform that action at this time.
0 commit comments