MediaWiki  REL1_19
digit2html.php
Go to the documentation of this file.
00001 <?php
00021 require_once( dirname( __FILE__ ) . '/../Maintenance.php' );
00022 
00023 class Digit2Html extends Maintenance {
00024 
00025         # A list of unicode numerals is available at:
00026         # http://www.fileformat.info/info/unicode/category/Nd/list.htm
00027         private $mLangs = array(
00028                 'Ar', 'As', 'Bh', 'Bo', 'Dz',
00029                 'Fa', 'Gu', 'Hi', 'Km', 'Kn',
00030                 'Ks', 'Lo', 'Ml', 'Mr', 'Ne',
00031                 'New', 'Or', 'Pa', 'Pi', 'Sa'
00032         );
00033 
00034         public function __construct() {
00035                 parent::__construct();
00036                 $this->mDescription = "Check digit transformation";
00037         }
00038 
00039         public function execute() {
00040                 foreach ( $this->mLangs as $code ) {
00041                         $filename = Language::getMessagesFileName( $code );
00042                         $this->output( "Loading language [$code] ... " );
00043                         unset( $digitTransformTable );
00044                         require_once( $filename );
00045                         if ( !isset( $digitTransformTable ) ) {
00046                                 $this->error( "\$digitTransformTable not found for lang: $code" );
00047                                 continue;
00048                         }
00049 
00050                         $this->output( "OK\n\$digitTransformTable = array(\n" );
00051                         foreach ( $digitTransformTable as $latin => $translation ) {
00052                                 $htmlent = utf8ToHexSequence( $translation );
00053                                 $this->output( "'$latin' => '$translation', # &#x$htmlent;\n" );
00054                         }
00055                         $this->output( ");\n" );
00056                 }
00057         }
00058 }
00059 
00060 $maintClass = "Digit2Html";
00061 require_once( RUN_MAINTENANCE_IF_MAIN );