Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/translation/lib/RevcheckFileList.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function loadTreeRecurse( $lang , $path )
continue;
}

if ( RevcheckIgnore::ignore( $key ) )
if ( RevcheckIgnore::byName( $key ) )
continue;
$file = new RevcheckFileItem( $key , $entry->getSize() );
$this->list[ $key ] = $file;
Expand Down
40 changes: 4 additions & 36 deletions scripts/translation/lib/RevcheckIgnore.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,63 +13,31 @@
* +----------------------------------------------------------------------+
* | Authors: André L F S Bacci <ae php.net> |
* +----------------------------------------------------------------------+
* | Description: Files ignored on translation tree. |
* | Description: Files ignored on manual tree. |
* +----------------------------------------------------------------------+
*/

require_once __DIR__ . '/all.php';

class RevcheckIgnore
{
public static function ignore( $filename ) : bool
public static function byName( $filename ) : bool
{
// Ignore dot files

if ( $filename[0] == '.' )
return true;

// Ignore files other than xml assets

if ( ( str_ends_with( $filename , '.xml' ) || str_ends_with( $filename , '.ent' ) ) == false )
return true;

// Ignore autogenerated files

if ( str_starts_with( $filename , "entities." ) )
return true;
if ( str_contains( $filename , "/entities." ) )
return true;
if ( str_contains( $filename , "/versions.xml" ) )
return true;

// Only in English, autogenerated, marked not translatable

if ( $filename == "contributors.ent" )
return true;
if ( $filename == "contributors.xml" )
return true;
if ( $filename == "appendices/license.xml" )
return true;
if ( $filename == "appendices/extensions.xml" )
return true;
if ( $filename == "appendices/reserved.constants.xml" )
return true;
if ( $filename == "reference/datetime/timezones.xml" )
return true;

// Only in translations

if ( $filename == "translation.xml" )
Comment thread
kamil-tekiela marked this conversation as resolved.
return true;

// At least, do not ignore
return false;
}

public static function mark( $filename )
public static function byMark( $filename )
{
$contents = file_get_contents( $filename );
$skip = strpos( $contents , '<?do-not-translate?>' ) !== false;
return $skip;
return str_contains( $contents , '<?do-not-translate?>' );
}
}
2 changes: 1 addition & 1 deletion scripts/translation/lib/RevcheckRun.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private function calculateStatus()

if ( $target == null )
{
if ( RevcheckIgnore::mark( "{$this->sourceDir}/{$source->file}" ) )
if ( RevcheckIgnore::byMark( "{$this->sourceDir}/{$source->file}" ) )
continue;

$source->status = RevcheckStatus::Untranslated;
Expand Down