diff --git a/scripts/file-entities.php b/scripts/file-entities.php index b6b277d86b..feb632ba5e 100644 --- a/scripts/file-entities.php +++ b/scripts/file-entities.php @@ -87,15 +87,17 @@ $entities = []; $mixedCase = []; +$englishEntities = null; generate_file_entities( $root , "en" ); generate_list_entities( $root , "en" ); -if ( $lang != "" ) - generate_file_entities( $root , $lang ); - pushEntity( "global.function-index", path: realpain( __DIR__ . "/.." ) . "/funcindex.xml" ); +$englishEntities = $entities; +if ( $lang && $lang !== "en" ) + generate_file_entities( $root , $lang ); + if ( ! $chmonly ) foreach( $entities as $ent ) if ( str_starts_with( $ent->name , "chmonly." ) ) @@ -134,9 +136,20 @@ function pushEntity( string $name , string $text = '' , string $path = '' ) { global $entities; global $mixedCase; + global $englishEntities; + global $lang; $name = str_replace( '_' , '-' , $name ); $path = str_replace( '\\' , '/' , $path ); + + // Prevents doc-en to load entities from doc-lang. Resulting in it rendering + // a different language when the underlying doc-en XML file has been removed. + if ( $lang === 'en' && $englishEntities !== null && ! isset( $englishEntities[ $name ] ) ) + { + $text = ' '; + $path = ''; + } + $ent = new Entity( $name , $text , $path ); $entities[ $name ] = $ent;