14 private int $wikitextCount;
15 private const WIKITEXT_REGEX =
'/{?{(PLURAL|GRAMMAR|GENDER):/';
16 private const EXCLUDED_TARGET_LANGUAGES = [
'zh' ];
18 protected function handlePairsForService( array $response ): array {
20 foreach ( $response[$this->getServiceName()] as $source => $targets ) {
21 $filteredTargets = array_diff( $targets, self::EXCLUDED_TARGET_LANGUAGES );
22 foreach ( $filteredTargets as $target ) {
23 $pairs[$source][$target] =
true;
30 protected function getServiceName():
string {
34 protected function handleServiceResponse( array $responseBody ):
string {
40 $this->wikitextCount = preg_match_all( self::WIKITEXT_REGEX, $text );
45 if ( $this->wikitextCount !== 0 ) {
47 $postWikitextCount = preg_match_all( self::WIKITEXT_REGEX, $text );
48 if ( $postWikitextCount !== $this->wikitextCount ) {