3 * Generates the normalizer data file for Malayalam.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
21 * @ingroup MaintenanceLanguage
24 // @codeCoverageIgnoreStart
25 require_once __DIR__
. '/../Maintenance.php';
26 // @codeCoverageIgnoreEnd
28 use Wikimedia\StaticArrayWriter
;
31 * Generates the normalizer data file for Malayalam.
33 * This data file is used after normalizing to NFC.
35 * @ingroup MaintenanceLanguage
37 class GenerateNormalizerDataMl
extends Maintenance
{
38 public function __construct() {
39 parent
::__construct();
40 $this->addDescription( 'Generate the normalizer data file for Malayalam' );
43 public function getDbType() {
44 return Maintenance
::DB_NONE
;
47 public function execute() {
49 # From https://www.unicode.org/versions/Unicode5.1.0/#Malayalam_Chillu_Characters
50 '0D23 0D4D 200D' => '0D7A',
51 '0D28 0D4D 200D' => '0D7B',
52 '0D30 0D4D 200D' => '0D7C',
53 '0D32 0D4D 200D' => '0D7D',
54 '0D33 0D4D 200D' => '0D7E',
56 # From http://permalink.gmane.org/gmane.science.linguistics.wikipedia.technical/46413
57 '0D15 0D4D 200D' => '0D7F',
61 foreach ( $hexPairs as $hexSource => $hexDest ) {
62 $source = UtfNormal\Utils
::hexSequenceToUtf8( $hexSource );
63 $dest = UtfNormal\Utils
::hexSequenceToUtf8( $hexDest );
64 $pairs[$source] = $dest;
68 $writer = new StaticArrayWriter();
69 file_put_contents( "$IP/includes/languages/data/NormalizeMl.php", $writer->writeClass(
72 'header' => 'Generated by generateNormalizerDataMl.php. Do not modify!',
73 'namespace' => 'MediaWiki\\Languages\\Data',
74 'class' => 'NormalizeMl',
79 echo "ml: " . count( $pairs ) . " pairs written.\n";
83 // @codeCoverageIgnoreStart
84 $maintClass = GenerateNormalizerDataMl
::class;
85 require_once RUN_MAINTENANCE_IF_MAIN
;
86 // @codeCoverageIgnoreEnd