From 8ea9c3abb3e6613ad817c7ba254804135af962d4 Mon Sep 17 00:00:00 2001 From: Jordi Kroon Date: Sat, 4 Jul 2026 11:02:11 +0200 Subject: [PATCH 1/2] Prevent doc-lang entities loading when doc-en file removed --- scripts/file-entities.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/file-entities.php b/scripts/file-entities.php index b6b277d86b..2d23fd1089 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,19 @@ function pushEntity( string $name , string $text = '' , string $path = '' ) { global $entities; global $mixedCase; + global $englishEntities; $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 ( $englishEntities !== null && ! isset( $englishEntities[ $name ] ) ) + { + $text = ' '; + $path = ''; + } + $ent = new Entity( $name , $text , $path ); $entities[ $name ] = $ent; From 306fb9de8fd80c2dca5c0efc7dfe2c57c45d84fd Mon Sep 17 00:00:00 2001 From: Jordi Kroon Date: Sat, 4 Jul 2026 23:49:09 +0200 Subject: [PATCH 2/2] add extra check for english docs --- scripts/file-entities.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/file-entities.php b/scripts/file-entities.php index 2d23fd1089..feb632ba5e 100644 --- a/scripts/file-entities.php +++ b/scripts/file-entities.php @@ -137,13 +137,14 @@ 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 ( $englishEntities !== null && ! isset( $englishEntities[ $name ] ) ) + if ( $lang === 'en' && $englishEntities !== null && ! isset( $englishEntities[ $name ] ) ) { $text = ' '; $path = '';