Language Converter
Finite-State Transducer implementation of MediaWiki LanguageConverter
|
A replacement machine that leaves text untouched. More...
Public Member Functions | |||||||||||||
__construct (string $baseLanguage) | |||||||||||||
Create a NullReplacementMachine. | |||||||||||||
getCodes () | |||||||||||||
Return the set of language codes supported.Both key and value are set in order to facilitate inclusion testing.
| |||||||||||||
isValidCodePair ( $destCode, $invertCode) | |||||||||||||
Override this method in subclass if you want to limit the possible code pairs bracketed.(For example, zh has a large number of variants, but we typically want to use only a limited number of these as possible invert codes.)
| |||||||||||||
convert ( $document, $s, $destCode, $invertCode) | |||||||||||||
Convert a string of text.
| |||||||||||||
Public Member Functions inherited from Wikimedia\LangConv\ReplacementMachine | |||||||||||||
__construct () | |||||||||||||
ReplacementMachine constructor. | |||||||||||||
replace ( $textNode, $destCode, $invertCode) | |||||||||||||
Replace the given text Node with converted text, protecting any markup which can't be round-tripped back to invertCode with appropriate synthetic language-converter markup. | |||||||||||||
jsonEncode (array $obj) | |||||||||||||
Allow client to customize the JSON encoding of data-mw-variant attributes. | |||||||||||||
A replacement machine that leaves text untouched.
Wikimedia\LangConv\NullReplacementMachine::__construct | ( | string | $baseLanguage | ) |
Create a NullReplacementMachine.
string | $baseLanguage | A base language code |
Wikimedia\LangConv\NullReplacementMachine::convert | ( | $document, | |
$s, | |||
$destCode, | |||
$invertCode ) |
Convert a string of text.
DOMDocument | $document | |
string | $s | text to convert |
string | $destCode | destination language code |
string | $invertCode |
Reimplemented from Wikimedia\LangConv\ReplacementMachine.
Wikimedia\LangConv\NullReplacementMachine::getCodes | ( | ) |
Return the set of language codes supported.Both key and value are set in order to facilitate inclusion testing.
Reimplemented from Wikimedia\LangConv\ReplacementMachine.
Wikimedia\LangConv\NullReplacementMachine::isValidCodePair | ( | $destCode, | |
$invertCode ) |
Override this method in subclass if you want to limit the possible code pairs bracketed.(For example, zh has a large number of variants, but we typically want to use only a limited number of these as possible invert codes.)
string | $destCode | |
string | $invertCode |
Reimplemented from Wikimedia\LangConv\ReplacementMachine.