diff --git a/docs/editing.md b/docs/editing.md index b73f75a676..bb1111318a 100644 --- a/docs/editing.md +++ b/docs/editing.md @@ -38,6 +38,9 @@ Changes in the English version are eventually picked up by the translators. If a change doesn't affect translations (e.g. fixing a typo in English) then the commit message should start with `[skip-revcheck]`. +Files that are not to be translated, or copied on translations, should include +an `` mark. + ## Validating your changes Every time you make changes to documentation sources (both English or translation), you have to validate your changes to ensure that the manual still builds without error. diff --git a/scripts/broken.php b/scripts/broken.php index 8908786487..8d6c80b016 100644 --- a/scripts/broken.php +++ b/scripts/broken.php @@ -1,6 +1,6 @@ ' ) !== false ) + { + echo "File marked do-not-translate in translation:\n"; + echo " Issue: Manual build may fail.\n"; + echo " Path: $filename\n"; echo "\n"; autofix_dos2unix( $filename ); } @@ -121,7 +138,7 @@ function testFile( string $filename , bool $fragment = false ) $doc->substituteEntities = false; libxml_use_internal_errors( true ); - if ( $fragment ) + if ( $fragmentDir ) $contents = "{$contents}"; $doc->loadXML( $contents ); @@ -152,18 +169,18 @@ function testFile( string $filename , bool $fragment = false ) } } -function testDir( string $dir ) +function testDir( string $dir , bool $checkDnt ) { $dir = realpath( $dir ); $files = scandir( $dir ); - $fragment = false; + $fragmentDir = false; $subdirs = []; foreach( $files as $file ) { if ( $file == ".xmlfragmentdir" ) { - $fragment = true; + $fragmentDir = true; continue; } if ( $file[0] == "." ) @@ -178,11 +195,11 @@ function testDir( string $dir ) } if ( str_ends_with( $fullpath , ".xml" ) ) - testFile( $fullpath , $fragment ); + testFile( $fullpath , $checkDnt , $fragmentDir ); } foreach( $subdirs as $dir ) - testDir( $dir ); + testDir( $dir , $checkDnt ); } function autofix_dos2unix( string $filename ) diff --git a/scripts/translation/lib/RevcheckIgnore.php b/scripts/translation/lib/RevcheckIgnore.php index 657d3707e2..27f77104d3 100644 --- a/scripts/translation/lib/RevcheckIgnore.php +++ b/scripts/translation/lib/RevcheckIgnore.php @@ -1,7 +1,7 @@ ' ) !== false; + return $skip; + } } diff --git a/scripts/translation/lib/RevcheckRun.php b/scripts/translation/lib/RevcheckRun.php index e80f5dfb48..119dfebdb7 100644 --- a/scripts/translation/lib/RevcheckRun.php +++ b/scripts/translation/lib/RevcheckRun.php @@ -82,6 +82,9 @@ private function calculateStatus() if ( $target == null ) { + if ( RevcheckIgnore::mark( "{$this->sourceDir}/{$source->file}" ) ) + continue; + $source->status = RevcheckStatus::Untranslated; $this->filesUntranslated[] = $source; $this->addData( $source , null );