Skip to content

Commit 9391318

Browse files
authored
Remove filename conventions for do-not-translate in revcheck (#319)
1 parent 4555190 commit 9391318

3 files changed

Lines changed: 6 additions & 38 deletions

File tree

scripts/translation/lib/RevcheckFileList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function loadTreeRecurse( $lang , $path )
6868
continue;
6969
}
7070

71-
if ( RevcheckIgnore::ignore( $key ) )
71+
if ( RevcheckIgnore::byName( $key ) )
7272
continue;
7373
$file = new RevcheckFileItem( $key , $entry->getSize() );
7474
$this->list[ $key ] = $file;

scripts/translation/lib/RevcheckIgnore.php

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -13,63 +13,31 @@
1313
* +----------------------------------------------------------------------+
1414
* | Authors: André L F S Bacci <ae php.net> |
1515
* +----------------------------------------------------------------------+
16-
* | Description: Files ignored on translation tree. |
16+
* | Description: Files ignored on manual tree. |
1717
* +----------------------------------------------------------------------+
1818
*/
1919

2020
require_once __DIR__ . '/all.php';
2121

2222
class RevcheckIgnore
2323
{
24-
public static function ignore( $filename ) : bool
24+
public static function byName( $filename ) : bool
2525
{
26-
// Ignore dot files
27-
2826
if ( $filename[0] == '.' )
2927
return true;
3028

31-
// Ignore files other than xml assets
32-
3329
if ( ( str_ends_with( $filename , '.xml' ) || str_ends_with( $filename , '.ent' ) ) == false )
3430
return true;
3531

36-
// Ignore autogenerated files
37-
38-
if ( str_starts_with( $filename , "entities." ) )
39-
return true;
40-
if ( str_contains( $filename , "/entities." ) )
41-
return true;
42-
if ( str_contains( $filename , "/versions.xml" ) )
43-
return true;
44-
45-
// Only in English, autogenerated, marked not translatable
46-
47-
if ( $filename == "contributors.ent" )
48-
return true;
49-
if ( $filename == "contributors.xml" )
50-
return true;
51-
if ( $filename == "appendices/license.xml" )
52-
return true;
53-
if ( $filename == "appendices/extensions.xml" )
54-
return true;
55-
if ( $filename == "appendices/reserved.constants.xml" )
56-
return true;
57-
if ( $filename == "reference/datetime/timezones.xml" )
58-
return true;
59-
60-
// Only in translations
61-
6232
if ( $filename == "translation.xml" )
6333
return true;
6434

65-
// At least, do not ignore
6635
return false;
6736
}
6837

69-
public static function mark( $filename )
38+
public static function byMark( $filename )
7039
{
7140
$contents = file_get_contents( $filename );
72-
$skip = strpos( $contents , '<?do-not-translate?>' ) !== false;
73-
return $skip;
41+
return str_contains( $contents , '<?do-not-translate?>' );
7442
}
7543
}

scripts/translation/lib/RevcheckRun.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private function calculateStatus()
8282

8383
if ( $target == null )
8484
{
85-
if ( RevcheckIgnore::mark( "{$this->sourceDir}/{$source->file}" ) )
85+
if ( RevcheckIgnore::byMark( "{$this->sourceDir}/{$source->file}" ) )
8686
continue;
8787

8888
$source->status = RevcheckStatus::Untranslated;

0 commit comments

Comments
 (0)