14 private const WIKITEXT_REGEX = [
15 '/\b(PLURAL|GRAMMAR|GENDER)\b/',
16 '/==\s*([^=]+)\s*==/',
18 '/\[\[([^\[\]]+)\]\]/',
21 private const EXCLUDED_TARGET_LANGUAGES = [
'zh' ];
23 protected function handlePairsForService( array $response ): array {
25 foreach ( $response[$this->getServiceName()] as $source => $targets ) {
26 $filteredTargets = array_diff( $targets, self::EXCLUDED_TARGET_LANGUAGES );
27 foreach ( $filteredTargets as $target ) {
28 $pairs[$source][$target] =
true;
35 protected function getServiceName():
string {
39 protected function handleServiceResponse( array $responseBody ):
string {
45 foreach ( self::WIKITEXT_REGEX as $pattern ) {
46 if ( preg_match( $pattern, $text ) ) {
48 'Wikitext instance(s) in source string. See T349375'