Merge "Use __DIR__ instead of dirname( __FILE__ )"
[lhc/web/wiklou.git] / maintenance / language / digit2html.php
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 *
18 * @ingroup MaintenanceLanguage
19 */
20
21 require_once( __DIR__ . '/../Maintenance.php' );
22
23 class Digit2Html extends Maintenance {
24
25 # A list of unicode numerals is available at:
26 # http://www.fileformat.info/info/unicode/category/Nd/list.htm
27 private $mLangs = array(
28 'Ar', 'As', 'Bh', 'Bo', 'Dz',
29 'Fa', 'Gu', 'Hi', 'Km', 'Kn',
30 'Ks', 'Lo', 'Ml', 'Mr', 'Ne',
31 'New', 'Or', 'Pa', 'Pi', 'Sa'
32 );
33
34 public function __construct() {
35 parent::__construct();
36 $this->mDescription = "Check digit transformation";
37 }
38
39 public function execute() {
40 foreach ( $this->mLangs as $code ) {
41 $filename = Language::getMessagesFileName( $code );
42 $this->output( "Loading language [$code] ... " );
43 unset( $digitTransformTable );
44 require_once( $filename );
45 if ( !isset( $digitTransformTable ) ) {
46 $this->error( "\$digitTransformTable not found for lang: $code" );
47 continue;
48 }
49
50 $this->output( "OK\n\$digitTransformTable = array(\n" );
51 foreach ( $digitTransformTable as $latin => $translation ) {
52 $htmlent = utf8ToHexSequence( $translation );
53 $this->output( "'$latin' => '$translation', # &#x$htmlent;\n" );
54 }
55 $this->output( ");\n" );
56 }
57 }
58 }
59
60 $maintClass = "Digit2Html";
61 require_once( RUN_MAINTENANCE_IF_MAIN );