A generic regex validator and insertable that can be reused by other classes. More...
Public Member Functions | |
__construct ( $params) | |
Constructor function. | |
getIssues (TMessage $message, string $targetLanguage) | |
Public Member Functions inherited from MediaWiki\Extension\Translate\TranslatorInterface\Insertable\RegexInsertablesSuggester | |
getInsertables (string $text) | |
Returns the insertables in the message text. | |
Additional Inherited Members | |
Protected Member Functions inherited from MediaWiki\Extension\Translate\TranslatorInterface\Insertable\RegexInsertablesSuggester | |
mapInsertables (array $match) | |
Protected Attributes inherited from MediaWiki\Extension\Translate\TranslatorInterface\Insertable\RegexInsertablesSuggester | |
$regex = null | |
$display = null | |
$pre = null | |
$post = null | |
A generic regex validator and insertable that can be reused by other classes.
Definition at line 19 of file InsertableRegexValidator.php.
MediaWiki\Extension\Translate\Validation\Validators\InsertableRegexValidator::__construct | ( | $params | ) |
Constructor function.
array | string | $params | If params is specified as a string, it is used as the regex. Eg: "/\$[a-z0-9]+/". In this case display is the first value from the regex match. pre is also the first value from the regex match, post is left empty. |
If params is specified as a collection / array, see below for further details.
Example:
Details:
$params = [ 'regex' => (string, required) The regex to be used for insertable. Must use named captures. When specifying named captures, do not use the $ symbol in the name. In the above example, two named captures are used - pre
and post
'display' => (string) Mandatory value. The display value for the insertable. Named captures prefixed with $ are used here. 'pre' => (string) The pre value for the insertable. Named captures prefixed with $ are used here. If not specified, is set to the display value. 'post' => (string) The post value for the insertable. Named captures prefixed with $ are used here. If not specified, defaults to an empty string. ]
Reimplemented from MediaWiki\Extension\Translate\TranslatorInterface\Insertable\RegexInsertablesSuggester.
Definition at line 23 of file InsertableRegexValidator.php.
MediaWiki\Extension\Translate\Validation\Validators\InsertableRegexValidator::getIssues | ( | TMessage | $message, |
string | $targetLanguage ) |
Implements MediaWiki\Extension\Translate\Validation\MessageValidator.
Definition at line 38 of file InsertableRegexValidator.php.