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$variants, $variantfallbacks, $flags );
104
}
105
106
protected
function
loadDefaultTables
() {
107
$this->mTables = [
108
'lowercase'
=>
new
ReplacementArray
( $this->mUpperToLowerCaseLatin ),
109
'ike-cans'
=>
new
ReplacementArray
( $this->mToSyllabics ),
110
'ike-latn'
=>
new
ReplacementArray
( $this->mToLatin ),
111
'iu'
=>
new
ReplacementArray
()
112
];
113
}
114
123
public
function
translate
( $text, $toVariant ) {
124
// If $text is empty or only includes spaces, do nothing
125
// Otherwise translate it
126
if
( trim( $text ) ) {
127
$this->
loadTables
();
128
// To syllabics, first translate uppercase to lowercase Latin
129
if
( $toVariant ==
'ike-cans'
) {
130
$text = $this->mTables[
'lowercase'
]->replace( $text );
131
}
132
$text = $this->mTables[$toVariant]->replace( $text );
133
}
134
return
$text;
135
}
136
}
IuConverter
Conversion script between Latin and Syllabics for Inuktitut.
Definition
IuConverter.php:36
IuConverter\$mToSyllabics
$mToSyllabics
Definition
IuConverter.php:70
IuConverter\$mToLatin
$mToLatin
Definition
IuConverter.php:40
IuConverter\translate
translate( $text, $toVariant)
It translates text into variant.
Definition
IuConverter.php:123
IuConverter\$mDoContentConvert
$mDoContentConvert
Definition
IuConverter.php:38
IuConverter\loadDefaultTables
loadDefaultTables()
Load default conversion tables.
Definition
IuConverter.php:106
IuConverter\$mUpperToLowerCaseLatin
$mUpperToLowerCaseLatin
Definition
IuConverter.php:61
IuConverter\__construct
__construct( $langobj)
Definition
IuConverter.php:94
LanguageConverterSpecific
A class that extends LanguageConverter with specific behaviour.
Definition
LanguageConverterSpecific.php:26
LanguageConverter\loadTables
loadTables( $fromCache=true)
Load conversion tables either from the cache or the disk.
Definition
LanguageConverter.php:976
ReplacementArray
Wrapper around strtr() that holds replacements.
Definition
ReplacementArray.php:24
includes
language
converters
IuConverter.php
Generated on Sat Apr 6 2024 00:07:20 for MediaWiki by
1.9.8