Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
NumericalParameterInsertablesSuggester.php
1<?php
2declare( strict_types = 1 );
3
4namespace MediaWiki\Extension\Translate\TranslatorInterface\Insertable;
5
13 public function getInsertables( string $text ): array {
14 $insertables = [];
15
16 // $1, $2, $3 etc.
17 $matches = [];
18 preg_match_all(
19 '/\$\d+/',
20 $text,
21 $matches,
22 PREG_SET_ORDER
23 );
24 $new = array_map( static function ( $match ) {
25 return new Insertable( $match[0], $match[0] );
26 }, $matches );
27 $insertables = array_merge( $insertables, $new );
28
29 return $insertables;
30 }
31}
Insertable is a string that usually does not need translation and is difficult to type manually.