| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
require_once __DIR__ . '/../Maintenance.php'; |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
class Digit2Html extends Maintenance { |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
private $mLangs = [ |
| 40 |
'Ar', 'As', 'Bh', 'Bo', 'Dz', |
| 41 |
'Fa', 'Gu', 'Hi', 'Km', 'Kn', |
| 42 |
'Ks', 'Lo', 'Ml', 'Mr', 'Ne', |
| 43 |
'New', 'Or', 'Pa', 'Pi', 'Sa' |
| 44 |
]; |
| 45 |
|
| 46 |
public function __construct() { |
| 47 |
parent::__construct(); |
| 48 |
$this->addDescription( 'Check digit transformation' ); |
| 49 |
} |
| 50 |
|
| 51 |
public function execute() { |
| 52 |
$languageNameUtils = $this->getServiceContainer()->getLanguageNameUtils(); |
| 53 |
foreach ( $this->mLangs as $code ) { |
| 54 |
$filename = $languageNameUtils->getMessagesFileName( $code ); |
| 55 |
$this->output( "Loading language [$code] ..." ); |
| 56 |
unset( $digitTransformTable ); |
| 57 |
require_once $filename; |
| 58 |
if ( !isset( $digitTransformTable ) ) { |
| 59 |
$this->error( "\$digitTransformTable not found for lang: $code" ); |
| 60 |
continue; |
| 61 |
} |
| 62 |
|
| 63 |
$this->output( "OK\n\$digitTransformTable = [\n" ); |
| 64 |
foreach ( $digitTransformTable as $latin => $translation ) { |
| 65 |
$htmlent = bin2hex( $translation ); |
| 66 |
$this->output( "'$latin' => '$translation', # &#x$htmlent;\n" ); |
| 67 |
} |
| 68 |
$this->output( "];\n" ); |
| 69 |
} |
| 70 |
} |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
$maintClass = Digit2Html::class; |
| 75 |
require_once RUN_MAINTENANCE_IF_MAIN; |
| 76 |
|