MediaWiki
REL1_39
generateNormalizerDataMl.php
Go to the documentation of this file.
1
<?php
24
require_once __DIR__ .
'/../Maintenance.php'
;
25
26
use
Wikimedia\StaticArrayWriter
;
27
35
class
GenerateNormalizerDataMl
extends
Maintenance
{
36
public
function
__construct
() {
37
parent::__construct();
38
$this->
addDescription
(
'Generate the normalizer data file for Malayalam'
);
39
}
40
41
public
function
getDbType
() {
42
return
Maintenance::DB_NONE
;
43
}
44
45
public
function
execute
() {
46
$hexPairs = [
47
# From https:
//www.unicode.org/versions/Unicode5.1.0/#Malayalam_Chillu_Characters
48
'0D23 0D4D 200D'
=>
'0D7A'
,
49
'0D28 0D4D 200D'
=>
'0D7B'
,
50
'0D30 0D4D 200D'
=>
'0D7C'
,
51
'0D32 0D4D 200D'
=>
'0D7D'
,
52
'0D33 0D4D 200D'
=>
'0D7E'
,
53
54
# From http:
//permalink.gmane.org/gmane.science.linguistics.wikipedia.technical/46413
55
'0D15 0D4D 200D'
=>
'0D7F'
,
56
];
57
58
$pairs = [];
59
foreach
( $hexPairs as $hexSource => $hexDest ) {
60
$source
= UtfNormal\Utils::hexSequenceToUtf8( $hexSource );
61
$dest = UtfNormal\Utils::hexSequenceToUtf8( $hexDest );
62
$pairs[
$source
] = $dest;
63
}
64
65
global
$IP
;
66
$writer =
new
StaticArrayWriter
();
67
file_put_contents(
"$IP/includes/languages/data/NormalizeMl.php"
, $writer->writeClass(
68
$pairs,
69
[
70
'header'
=>
'Generated by generateNormalizerDataMl.php. Do not modify!'
,
71
'namespace'
=>
'MediaWiki\\Languages\\Data'
,
72
'class'
=>
'NormalizeMl'
,
73
'const'
=>
'PAIRS'
,
74
]
75
) );
76
77
echo
"ml: "
. count( $pairs ) .
" pairs written.\n"
;
78
}
79
}
80
81
$maintClass
= GenerateNormalizerDataMl::class;
82
require_once RUN_MAINTENANCE_IF_MAIN;
$IP
if(!defined( 'MEDIAWIKI')) if(ini_get('mbstring.func_overload')) if(!defined( 'MW_ENTRY_POINT')) global $IP
Environment checks.
Definition
Setup.php:91
GenerateNormalizerDataMl
Generates the normalizer data file for Malayalam.
Definition
generateNormalizerDataMl.php:35
GenerateNormalizerDataMl\execute
execute()
Do the actual work.
Definition
generateNormalizerDataMl.php:45
GenerateNormalizerDataMl\__construct
__construct()
Default constructor.
Definition
generateNormalizerDataMl.php:36
GenerateNormalizerDataMl\getDbType
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
Definition
generateNormalizerDataMl.php:41
Maintenance
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition
Maintenance.php:66
Maintenance\DB_NONE
const DB_NONE
Constants for DB access type.
Definition
Maintenance.php:71
Maintenance\addDescription
addDescription( $text)
Set the description text.
Definition
Maintenance.php:319
Wikimedia\StaticArrayWriter
Format a static PHP array to be written to a file.
Definition
StaticArrayWriter.php:27
$maintClass
$maintClass
Definition
generateNormalizerDataMl.php:81
$source
$source
Definition
mwdoc-filter.php:34
maintenance
language
generateNormalizerDataMl.php
Generated on Tue Oct 8 2024 07:24:53 for MediaWiki by
1.10.0