31 private bool $allowPotMode =
false;
32 private bool $offlineMode =
false;
42 public function setOfflineMode(
bool $value ): void {
43 $this->offlineMode = $value;
47 public function read( $languageCode ) {
50 $this->allowPotMode = $this->getGroup()->getSourceLanguage() === $languageCode;
53 return parent::read( $languageCode );
55 $this->allowPotMode =
false;
62 preg_match_all(
'/^#\s*Author:\s*(.*)$/m', $data, $matches );
63 $authors = $matches[1];
65 # Then messages and everything else
66 $parsedData = $this->parseGettext( $data );
67 $parsedData[
'AUTHORS'] = $authors;
69 foreach ( $parsedData[
'MESSAGES'] as $key => $value ) {
70 if ( $value ===
'' ) {
71 unset( $parsedData[
'MESSAGES'][$key] );
78 private function parseGettext(
string $data ): array {
79 $mangler = $this->group->getMangler();
80 $useCtxtAsKey = $this->extra[
'CtxtAsKey'] ??
false;
81 $keyAlgorithm =
'simple';
82 if ( isset( $this->extra[
'keyAlgorithm'] ) ) {
83 $keyAlgorithm = $this->extra[
'keyAlgorithm'];
89 $data = str_replace(
"\r\n",
"\n", $data );
94 $sections = preg_split(
'/\n{2,}/', $data );
97 $headerSection = array_shift( $sections );
101 $match = $this->expectKeyword(
'msgstr', $headerSection );
102 if ( $match !==
null ) {
103 $headerBlock = $this->formatForWiki( $match,
'trim' );
104 $headers = $this->parseHeaderTags( $headerBlock );
107 $flags = $this->parseFlags( $headerSection );
108 if ( in_array(
'fuzzy', $flags,
true ) ) {
109 $potmode = $this->allowPotMode;
112 $message =
"Gettext file header was not found:\n\n$data";
113 throw new GettextParseException( $message );
121 if ( isset( $headers[
'X-Language-Code'] ) ) {
122 $metadata[
'code'] = $headers[
'X-Language-Code'];
125 if ( isset( $headers[
'X-Message-Group'] ) ) {
126 $metadata[
'group'] = $headers[
'X-Message-Group'];
134 } elseif ( isset( $headers[
'Plural-Forms'] ) ) {
135 $pluralCount = $metadata[
'plural'] = GettextPlural::getPluralCount( $headers[
'Plural-Forms'] );
138 $metadata[
'plural'] = $pluralCount;
141 foreach ( $sections as $section ) {
142 $item = $this->parseGettextSection( $section, $pluralCount );
143 if ( $item ===
null ) {
147 if ( $useCtxtAsKey ) {
148 if ( !isset( $item[
'ctxt'] ) ) {
149 error_log(
"ctxt missing for: $section" );
152 $key = $item[
'ctxt'];
154 $key = $this->generateKeyFromItem( $item, $keyAlgorithm );
157 $key = $mangler->mangle( $key );
158 $messages[$key] = $potmode ? $item[
'id'] : $item[
'str'];
159 $template[$key] = $item;
163 'MESSAGES' => $messages,
165 'TEMPLATE' => $template,
166 'METADATA' => $metadata,
167 'HEADERS' => $headers,
172 private function parseGettextSection(
string $section, ?
int $pluralCount ): ?array {
173 if ( trim( $section ) ===
'' ) {
181 if ( preg_match(
'/^#~/m', $section ) ) {
193 $match = $this->expectKeyword(
'msgid', $section );
194 if ( $match !==
null ) {
195 $item[
'id'] = $this->formatForWiki( $match );
197 throw new RuntimeException(
"Unable to parse msgid:\n\n$section" );
200 $match = $this->expectKeyword(
'msgctxt', $section );
201 if ( $match !==
null ) {
202 $item[
'ctxt'] = $this->formatForWiki( $match );
205 $pluralMessage =
false;
206 $match = $this->expectKeyword(
'msgid_plural', $section );
207 if ( $match !==
null ) {
208 $pluralMessage =
true;
209 $plural = $this->formatForWiki( $match );
210 $item[
'id'] = GettextPlural::flatten( [ $item[
'id'], $plural ] );
213 if ( $pluralMessage ) {
214 $pluralMessageText = $this->processGettextPluralMessage( $pluralCount, $section );
217 if ( $pluralMessageText !==
'' ) {
218 $item[
'str'] = $pluralMessageText;
221 $match = $this->expectKeyword(
'msgstr', $section );
222 if ( $match !==
null ) {
223 $item[
'str'] = $this->formatForWiki( $match );
225 throw new RuntimeException(
"Unable to parse msgstr:\n\n$section" );
230 $flags = $this->parseFlags( $section );
231 foreach ( $flags as $key => $flag ) {
232 if ( $flag ===
'fuzzy' ) {
233 $item[
'str'] = TRANSLATE_FUZZY . $item[
'str'];
234 unset( $flags[$key] );
237 $item[
'flags'] = $flags;
241 if ( preg_match_all(
'/^#(.?) (.*)$/m', $section, $matches, PREG_SET_ORDER ) ) {
242 foreach ( $matches as $match ) {
243 if ( $match[1] !==
',' && !str_starts_with( $match[1],
'[Wiki]' ) ) {
244 $item[
'comments'][$match[1]][] = $match[2];
252 private function processGettextPluralMessage( ?
int $pluralCount,
string $section ): string {
255 for ( $i = 0; $i < $pluralCount; $i++ ) {
256 $match = $this->expectKeyword(
"msgstr\\[$i\\]", $section );
258 if ( $match !==
null ) {
259 $actualForms[] = $this->formatForWiki( $match );
262 error_log(
"Plural $i not found, expecting total of $pluralCount for $section" );
266 if ( array_sum( array_map(
'strlen', $actualForms ) ) > 0 ) {
267 return GettextPlural::flatten( $actualForms );
273 private function parseFlags(
string $section ): array {
275 if ( preg_match(
'/^#,(.*)$/mu', $section, $matches ) ) {
276 return array_map(
'trim', explode(
',', $matches[1] ) );
282 private function expectKeyword(
string $name,
string $section ): ?string {
286 $poformat =
'".*"\n?(^".*"$\n?)*';
289 if ( preg_match(
"/^$name\s($poformat)/mx", $section, $matches ) ) {
303 $lang = MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage(
'en' );
305 if ( $item[
'ctxt'] ===
'' ) {
309 $hash = sha1( $item[
'id'] .
'MSGEMPTYCTXT' );
311 $hash = sha1( $item[
'ctxt'] . $item[
'id'] );
314 if ( $algorithm ===
'simple' ) {
315 $hash = substr( $hash, 0, 6 );
316 $snippet = $lang->truncateForDatabase( $item[
'id'], 30,
'' );
317 $snippet = str_replace(
' ',
'_', trim( $snippet ) );
319 $legalChars = Title::legalChars();
320 $snippet = $item[
'id'];
321 $snippet = preg_replace(
"/[^$legalChars]/",
' ', $snippet );
322 $snippet = preg_replace(
'/[:&%\/_]/',
' ', $snippet );
323 $snippet = preg_replace(
'/ {2,}/',
' ', $snippet );
324 $snippet = $lang->truncateForDatabase( $snippet, 30,
'' );
325 $snippet = str_replace(
' ',
'_', trim( $snippet ) );
328 return "$hash-$snippet";
334 private function processData(
string $data ): string {
335 $quotePattern =
'/(^"|"$\n?)/m';
336 $data = preg_replace( $quotePattern,
'', $data );
337 return stripcslashes( $data );
344 private function handleWhitespace(
string $data,
string $whitespace ): string {
345 if ( preg_match(
'/\s$/', $data ) ) {
346 if ( $whitespace ===
'mark' ) {
348 } elseif ( $whitespace ===
'trim' ) {
349 $data = rtrim( $data );
352 throw new InvalidArgumentException(
"Unknown action for whitespace: $whitespace" );
365 private function formatForWiki(
string $data,
string $whitespace =
'mark' ): string {
366 $data = $this->processData( $data );
367 return $this->handleWhitespace( $data, $whitespace );
370 private function parseHeaderTags(
string $headers ): array {
372 foreach ( explode(
"\n", $headers ) as $line ) {
373 if ( !str_contains( $line,
':' ) ) {
374 error_log( __METHOD__ .
": $line" );
376 [ $key, $value ] = explode(
':', $line, 2 );
377 $tags[trim( $key )] = trim( $value );
383 protected function writeReal( MessageCollection $collection ): string {
385 $pot = $this->read(
'en' ) ?? [];
386 $code = $collection->code;
387 $template = $this->read( $code ) ?? [];
388 $output = $this->doGettextHeader( $collection, $template[
'EXTRA'] ?? [] );
390 $pluralRule = GettextPlural::getPluralRule( $code );
391 if ( !$pluralRule ) {
392 $pluralRule = GettextPlural::getPluralRule(
'en' );
393 LoggerFactory::getInstance( LogNames::MAIN )->warning(
394 "T235180: Missing Gettext plural rule for '{languagecode}'",
395 [
'languagecode' => $code ]
398 $pluralCount = GettextPlural::getPluralCount( $pluralRule );
400 $documentationLanguageCode = MediaWikiServices::getInstance()
402 ->get(
'TranslateDocumentationLanguageCode' );
403 $documentationCollection =
null;
404 if ( is_string( $documentationLanguageCode ) ) {
405 $documentationCollection = clone $collection;
406 $documentationCollection->resetForNewLanguage( $documentationLanguageCode );
407 $documentationCollection->loadTranslations();
411 foreach ( $collection as $key => $m ) {
412 $transTemplate = $template[
'EXTRA'][
'TEMPLATE'][$key] ?? [];
413 $potTemplate = $pot[
'EXTRA'][
'TEMPLATE'][$key] ?? [];
414 $documentation = isset( $documentationCollection[$key] ) ?
415 $documentationCollection[$key]->translation() :
null;
417 $output .= $this->formatMessageBlock(
430 private function doGettextHeader( MessageCollection $collection, array $template ): string {
433 $code = $collection->code;
434 $name = Utilities::getLanguageName( $code );
435 $native = Utilities::getLanguageName( $code, $code );
436 $authors = $this->doAuthors( $collection );
437 if ( isset( $this->extra[
'header'] ) ) {
438 $extra =
"# --\n" . $this->extra[
'header'];
443 $group = $this->getGroup();
446 # Translation of {$group->getLabel()} to $name ($native)
447 # Exported from $wgSitename
453 $output = trim( $output ) .
"\n";
455 $specs = $template[
'HEADERS'] ?? [];
457 $timestamp = wfTimestampNow();
458 $specs[
'PO-Revision-Date'] = $this->formatTime( $timestamp );
459 if ( $this->offlineMode ) {
460 $specs[
'POT-Creation-Date'] = $this->formatTime( $timestamp );
462 $specs[
'X-POT-Import-Date'] = $this->formatTime( wfTimestamp( TS_MW, $this->getPotTime() ) );
464 $specs[
'Content-Type'] =
'text/plain; charset=UTF-8';
465 $specs[
'Content-Transfer-Encoding'] =
'8bit';
467 $specs[
'Language'] = LanguageCode::bcp47( $this->group->mapCode( $code ) );
469 Services::getInstance()->getHookRunner()->onTranslate_GettextFormat_headerFields(
475 $specs[
'X-Generator'] =
'MediaWiki '
476 . SpecialVersion::getVersion()
478 . Utilities::getVersion();
480 if ( $this->offlineMode ) {
481 $specs[
'X-Language-Code'] = $code;
482 $specs[
'X-Message-Group'] = $group->getId();
485 $specs[
'Plural-Forms'] = GettextPlural::getPluralRule( $code )
486 ?: GettextPlural::getPluralRule(
'en' );
488 $output .=
'msgid ""' .
"\n";
489 $output .=
'msgstr ""' .
"\n";
490 $output .=
'""' .
"\n";
492 foreach ( $specs as $k => $v ) {
493 $output .= $this->escape(
"$k: $v\n" ) .
"\n";
501 private function doAuthors( MessageCollection $collection ): string {
503 $authors = $collection->getAuthors();
504 $authors = $this->filterAuthors( $authors, $collection->code );
506 foreach ( $authors as $author ) {
507 $output .=
"# Author: $author\n";
513 private function formatMessageBlock(
519 ?
string $documentation
521 $header = $this->formatDocumentation( $documentation );
524 $comments = $pot[
'comments'] ?? $trans[
'comments'] ?? [];
525 foreach ( $comments as $type => $typecomments ) {
526 foreach ( $typecomments as $comment ) {
527 $header .=
"#$type $comment\n";
531 $flags = $pot[
'flags'] ?? $trans[
'flags'] ?? [];
532 $flags = array_merge( $message->getTags(), $flags );
534 if ( $this->offlineMode ) {
535 $content .=
'msgctxt ' . $this->escape( $key ) .
"\n";
537 $ctxt = $pot[
'ctxt'] ?? $trans[
'ctxt'] ??
false;
538 if ( $ctxt !==
false ) {
539 $content .=
'msgctxt ' . $this->escape( $ctxt ) .
"\n";
543 $msgid = $message->definition();
544 $msgstr = $message->translation() ??
'';
545 if ( strpos( $msgstr, TRANSLATE_FUZZY ) !==
false ) {
546 $msgstr = str_replace( TRANSLATE_FUZZY,
'', $msgstr );
551 if ( GettextPlural::hasPlural( $msgid ) ) {
552 $forms = GettextPlural::unflatten( $msgid, 2 );
553 $content .=
'msgid ' . $this->escape( $forms[0] ) .
"\n";
554 $content .=
'msgid_plural ' . $this->escape( $forms[1] ) .
"\n";
557 $forms = GettextPlural::unflatten( $msgstr, $pluralCount );
558 foreach ( $forms as $index => $form ) {
559 $content .=
"msgstr[$index] " . $this->escape( $form ) .
"\n";
561 }
catch ( GettextPluralException $e ) {
562 $flags[] =
'invalid-plural';
563 for ( $i = 0; $i < $pluralCount; $i++ ) {
564 $content .=
"msgstr[$i] \"\"\n";
568 $content .=
'msgid ' . $this->escape( $msgid ) .
"\n";
569 $content .=
'msgstr ' . $this->escape( $msgstr ) .
"\n";
574 $header .=
'#, ' . implode(
', ', array_unique( $flags ) ) .
"\n";
577 $output = $header ?:
"#\n";
578 $output .= $content .
"\n";
583 private function formatTime(
string $time ): string {
584 $lang = MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage(
'en' );
586 return $lang->sprintfDate(
'xnY-xnm-xnd xnH:xni:xns+0000', $time );
589 private function getPotTime(): string {
590 $cache = $this->group->getMessageGroupCache( $this->group->getSourceLanguage() );
592 return $cache->exists() ? $cache->getTimestamp() : wfTimestampNow();
595 private function formatDocumentation( ?
string $documentation ): string {
596 if ( !is_string( $documentation ) ) {
600 if ( !$this->offlineMode ) {
604 $lines = explode(
"\n", $documentation );
606 foreach ( $lines as $line ) {
607 $out .=
"#. [Wiki] $line\n";
613 private function escape(
string $line ): string {
615 $line = preg_replace(
'/(\s)\\\\$/',
'\1', $line );
616 $line = addcslashes( $line,
'\\"' );
617 $line = str_replace(
"\n",
'\n', $line );
618 return '"' . $line .
'"';
621 public function shouldOverwrite(
string $a,
string $b ): bool {
622 $regex =
'/^"(.+)-Date: \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\+\d\d\d\d\\\\n"$/m';
624 $a = preg_replace( $regex,
'', $a );
625 $b = preg_replace( $regex,
'', $b );
630 public static function getExtraSchema(): array {
643 '_values' => [
'simple',
'legacy' ],
646 '_type' =>
'boolean',
655 public function isContentEqual( ?
string $a, ?
string $b ): bool {
660 if ( $a ===
null || $b ===
null ) {
665 $parsedA = GettextPlural::parsePluralForms( $a );
666 $parsedB = GettextPlural::parsePluralForms( $b );
669 if ( count( $parsedA[1] ) !== count( $parsedB[1] ) ) {
673 }
catch ( GettextPluralException $e ) {
678 $expectedPluralCount = count( $parsedA[1] );
682 if ( $expectedPluralCount === 0 ) {
686 return GettextPlural::unflatten( $a, $expectedPluralCount )
687 === GettextPlural::unflatten( $b, $expectedPluralCount );
return[ 'Translate:AggregateGroupManager'=> static function(MediaWikiServices $services):AggregateGroupManager { return new AggregateGroupManager($services->getTitleFactory(), $services->get( 'Translate:MessageGroupMetadata'));}, 'Translate:AggregateGroupMessageGroupFactory'=> static function(MediaWikiServices $services):AggregateGroupMessageGroupFactory { return new AggregateGroupMessageGroupFactory($services->get( 'Translate:MessageGroupMetadata'));}, 'Translate:ConfigHelper'=> static function():ConfigHelper { return new ConfigHelper();}, 'Translate:CsvTranslationImporter'=> static function(MediaWikiServices $services):CsvTranslationImporter { return new CsvTranslationImporter( $services->getWikiPageFactory());}, 'Translate:EntitySearch'=> static function(MediaWikiServices $services):EntitySearch { return new EntitySearch($services->getMainWANObjectCache(), $services->getCollationFactory() ->makeCollation( 'uca-default-u-kn'), MessageGroups::singleton(), $services->getNamespaceInfo(), $services->get( 'Translate:MessageIndex'), $services->getTitleParser(), $services->getTitleFormatter());}, 'Translate:ExternalMessageSourceStateComparator'=> static function(MediaWikiServices $services):ExternalMessageSourceStateComparator { return new ExternalMessageSourceStateComparator(new SimpleStringComparator(), $services->getRevisionLookup(), $services->getPageStore());}, 'Translate:ExternalMessageSourceStateImporter'=> static function(MediaWikiServices $services):ExternalMessageSourceStateImporter { return new ExternalMessageSourceStateImporter($services->get( 'Translate:GroupSynchronizationCache'), $services->getJobQueueGroup(), LoggerFactory::getInstance(LogNames::GROUP_SYNCHRONIZATION), $services->get( 'Translate:MessageIndex'), $services->getTitleFactory(), $services->get( 'Translate:MessageGroupSubscription'), new ServiceOptions(ExternalMessageSourceStateImporter::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'Translate:FileBasedMessageGroupFactory'=> static function(MediaWikiServices $services):FileBasedMessageGroupFactory { return new FileBasedMessageGroupFactory(new MessageGroupConfigurationParser(), new ServiceOptions(FileBasedMessageGroupFactory::SERVICE_OPTIONS, $services->getMainConfig()),);}, 'Translate:FileFormatFactory'=> static function(MediaWikiServices $services):FileFormatFactory { return new FileFormatFactory( $services->getObjectFactory());}, 'Translate:GroupSynchronizationCache'=> static function(MediaWikiServices $services):GroupSynchronizationCache { return new GroupSynchronizationCache( $services->get( 'Translate:PersistentCache'));}, 'Translate:HookDefinedMessageGroupFactory'=> static function(MediaWikiServices $services):HookDefinedMessageGroupFactory { return new HookDefinedMessageGroupFactory( $services->get( 'Translate:HookRunner'));}, 'Translate:HookRunner'=> static function(MediaWikiServices $services):HookRunner { return new HookRunner( $services->getHookContainer());}, 'Translate:MessageBundleDependencyPurger'=> static function(MediaWikiServices $services):MessageBundleDependencyPurger { return new MessageBundleDependencyPurger( $services->get( 'Translate:TranslatableBundleFactory'));}, 'Translate:MessageBundleMessageGroupFactory'=> static function(MediaWikiServices $services):MessageBundleMessageGroupFactory { return new MessageBundleMessageGroupFactory($services->get( 'Translate:MessageGroupMetadata'), new ServiceOptions(MessageBundleMessageGroupFactory::SERVICE_OPTIONS, $services->getMainConfig()),);}, 'Translate:MessageBundleStore'=> static function(MediaWikiServices $services):MessageBundleStore { return new MessageBundleStore($services->get( 'Translate:RevTagStore'), $services->getJobQueueGroup(), $services->getLanguageNameUtils(), $services->get( 'Translate:MessageIndex'), $services->get( 'Translate:MessageGroupMetadata'));}, 'Translate:MessageBundleTranslationLoader'=> static function(MediaWikiServices $services):MessageBundleTranslationLoader { return new MessageBundleTranslationLoader( $services->getLanguageFallback());}, 'Translate:MessageGroupMetadata'=> static function(MediaWikiServices $services):MessageGroupMetadata { return new MessageGroupMetadata( $services->getConnectionProvider());}, 'Translate:MessageGroupReviewStore'=> static function(MediaWikiServices $services):MessageGroupReviewStore { return new MessageGroupReviewStore($services->getConnectionProvider(), $services->get( 'Translate:HookRunner'));}, 'Translate:MessageGroupStatsTableFactory'=> static function(MediaWikiServices $services):MessageGroupStatsTableFactory { return new MessageGroupStatsTableFactory($services->get( 'Translate:ProgressStatsTableFactory'), $services->getLinkRenderer(), $services->get( 'Translate:MessageGroupReviewStore'), $services->get( 'Translate:MessageGroupMetadata'), $services->getMainConfig() ->get( 'TranslateWorkflowStates') !==false);}, 'Translate:MessageGroupSubscription'=> static function(MediaWikiServices $services):MessageGroupSubscription { return new MessageGroupSubscription($services->get( 'Translate:MessageGroupSubscriptionStore'), $services->getJobQueueGroup(), $services->getUserIdentityLookup(), LoggerFactory::getInstance(LogNames::GROUP_SUBSCRIPTION), new ServiceOptions(MessageGroupSubscription::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'Translate:MessageGroupSubscriptionHookHandler'=> static function(MediaWikiServices $services):MessageGroupSubscriptionHookHandler { return new MessageGroupSubscriptionHookHandler($services->get( 'Translate:MessageGroupSubscription'), $services->getUserFactory());}, 'Translate:MessageGroupSubscriptionStore'=> static function(MediaWikiServices $services):MessageGroupSubscriptionStore { return new MessageGroupSubscriptionStore( $services->getConnectionProvider());}, 'Translate:MessageIndex'=> static function(MediaWikiServices $services):MessageIndex { $params=(array) $services->getMainConfig() ->get( 'TranslateMessageIndex');$class=array_shift( $params);$implementationMap=['HashMessageIndex'=> HashMessageIndex::class, 'CDBMessageIndex'=> CDBMessageIndex::class, 'DatabaseMessageIndex'=> DatabaseMessageIndex::class, 'hash'=> HashMessageIndex::class, 'cdb'=> CDBMessageIndex::class, 'database'=> DatabaseMessageIndex::class,];$messageIndexStoreClass=$implementationMap[$class] ?? $implementationMap['database'];return new MessageIndex(new $messageIndexStoreClass, $services->getMainWANObjectCache(), $services->getJobQueueGroup(), $services->get( 'Translate:HookRunner'), LoggerFactory::getInstance(LogNames::MAIN), $services->getMainObjectStash(), $services->getConnectionProvider(), new ServiceOptions(MessageIndex::SERVICE_OPTIONS, $services->getMainConfig()),);}, 'Translate:MessagePrefixStats'=> static function(MediaWikiServices $services):MessagePrefixStats { return new MessagePrefixStats( $services->getTitleParser());}, 'Translate:ParsingPlaceholderFactory'=> static function():ParsingPlaceholderFactory { return new ParsingPlaceholderFactory();}, 'Translate:PersistentCache'=> static function(MediaWikiServices $services):PersistentCache { return new PersistentDatabaseCache($services->getConnectionProvider(), $services->getJsonCodec());}, 'Translate:ProgressStatsTableFactory'=> static function(MediaWikiServices $services):ProgressStatsTableFactory { return new ProgressStatsTableFactory($services->getLinkRenderer(), $services->get( 'Translate:ConfigHelper'), $services->get( 'Translate:MessageGroupMetadata'));}, 'Translate:RevTagStore'=> static function(MediaWikiServices $services):RevTagStore { return new RevTagStore( $services->getConnectionProvider());}, 'Translate:SubpageListBuilder'=> static function(MediaWikiServices $services):SubpageListBuilder { return new SubpageListBuilder($services->get( 'Translate:TranslatableBundleFactory'), $services->getLinkBatchFactory());}, 'Translate:TranslatableBundleDeleter'=> static function(MediaWikiServices $services):TranslatableBundleDeleter { return new TranslatableBundleDeleter($services->getMainObjectStash(), $services->getJobQueueGroup(), $services->get( 'Translate:SubpageListBuilder'), $services->get( 'Translate:TranslatableBundleFactory'));}, 'Translate:TranslatableBundleExporter'=> static function(MediaWikiServices $services):TranslatableBundleExporter { return new TranslatableBundleExporter($services->get( 'Translate:SubpageListBuilder'), $services->getWikiExporterFactory(), $services->getConnectionProvider());}, 'Translate:TranslatableBundleFactory'=> static function(MediaWikiServices $services):TranslatableBundleFactory { return new TranslatableBundleFactory($services->get( 'Translate:TranslatablePageStore'), $services->get( 'Translate:MessageBundleStore'));}, 'Translate:TranslatableBundleImporter'=> static function(MediaWikiServices $services):TranslatableBundleImporter { return new TranslatableBundleImporter($services->getWikiImporterFactory(), $services->get( 'Translate:TranslatablePageParser'), $services->getRevisionLookup(), $services->getNamespaceInfo(), $services->getTitleFactory(), $services->getFormatterFactory());}, 'Translate:TranslatableBundleMover'=> static function(MediaWikiServices $services):TranslatableBundleMover { return new TranslatableBundleMover($services->getMovePageFactory(), $services->getJobQueueGroup(), $services->getLinkBatchFactory(), $services->get( 'Translate:TranslatableBundleFactory'), $services->get( 'Translate:SubpageListBuilder'), $services->getConnectionProvider(), $services->getObjectCacheFactory(), $services->getMainConfig() ->get( 'TranslatePageMoveLimit'));}, 'Translate:TranslatableBundleStatusStore'=> static function(MediaWikiServices $services):TranslatableBundleStatusStore { return new TranslatableBundleStatusStore($services->getConnectionProvider() ->getPrimaryDatabase(), $services->getCollationFactory() ->makeCollation( 'uca-default-u-kn'), $services->getDBLoadBalancer() ->getMaintenanceConnectionRef(DB_PRIMARY));}, 'Translate:TranslatablePageMarker'=> static function(MediaWikiServices $services):TranslatablePageMarker { return new TranslatablePageMarker($services->getConnectionProvider(), $services->getJobQueueGroup(), $services->getLinkRenderer(), MessageGroups::singleton(), $services->get( 'Translate:MessageIndex'), $services->getTitleFormatter(), $services->getTitleParser(), $services->get( 'Translate:TranslatablePageParser'), $services->get( 'Translate:TranslatablePageStore'), $services->get( 'Translate:TranslatablePageStateStore'), $services->get( 'Translate:TranslationUnitStoreFactory'), $services->get( 'Translate:MessageGroupMetadata'), $services->getWikiPageFactory(), $services->get( 'Translate:TranslatablePageView'), $services->get( 'Translate:MessageGroupSubscription'), $services->getFormatterFactory());}, 'Translate:TranslatablePageMessageGroupFactory'=> static function(MediaWikiServices $services):TranslatablePageMessageGroupFactory { return new TranslatablePageMessageGroupFactory(new ServiceOptions(TranslatablePageMessageGroupFactory::SERVICE_OPTIONS, $services->getMainConfig()),);}, 'Translate:TranslatablePageParser'=> static function(MediaWikiServices $services):TranslatablePageParser { return new TranslatablePageParser($services->get( 'Translate:ParsingPlaceholderFactory'));}, 'Translate:TranslatablePageStateStore'=> static function(MediaWikiServices $services):TranslatablePageStateStore { return new TranslatablePageStateStore($services->get( 'Translate:PersistentCache'), $services->getPageStore());}, 'Translate:TranslatablePageStore'=> static function(MediaWikiServices $services):TranslatablePageStore { return new TranslatablePageStore($services->get( 'Translate:MessageIndex'), $services->getJobQueueGroup(), $services->get( 'Translate:RevTagStore'), $services->getConnectionProvider(), $services->get( 'Translate:TranslatableBundleStatusStore'), $services->get( 'Translate:TranslatablePageParser'), $services->get( 'Translate:MessageGroupMetadata'));}, 'Translate:TranslatablePageView'=> static function(MediaWikiServices $services):TranslatablePageView { return new TranslatablePageView($services->getConnectionProvider(), $services->get( 'Translate:TranslatablePageStateStore'), new ServiceOptions(TranslatablePageView::SERVICE_OPTIONS, $services->getMainConfig()));}, 'Translate:TranslateSandbox'=> static function(MediaWikiServices $services):TranslateSandbox { return new TranslateSandbox($services->getUserFactory(), $services->getConnectionProvider(), $services->getPermissionManager(), $services->getAuthManager(), $services->getUserGroupManager(), $services->getActorStore(), $services->getUserOptionsManager(), $services->getJobQueueGroup(), $services->get( 'Translate:HookRunner'), new ServiceOptions(TranslateSandbox::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'Translate:TranslationStashReader'=> static function(MediaWikiServices $services):TranslationStashReader { return new TranslationStashStorage( $services->getConnectionProvider() ->getPrimaryDatabase());}, 'Translate:TranslationStatsDataProvider'=> static function(MediaWikiServices $services):TranslationStatsDataProvider { return new TranslationStatsDataProvider(new ServiceOptions(TranslationStatsDataProvider::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getObjectFactory(), $services->getConnectionProvider());}, 'Translate:TranslationUnitStoreFactory'=> static function(MediaWikiServices $services):TranslationUnitStoreFactory { return new TranslationUnitStoreFactory( $services->getDBLoadBalancer());}, 'Translate:TranslatorActivity'=> static function(MediaWikiServices $services):TranslatorActivity { $query=new TranslatorActivityQuery($services->getMainConfig(), $services->getDBLoadBalancer());return new TranslatorActivity($services->getMainObjectStash(), $query, $services->getJobQueueGroup());}, 'Translate:TtmServerFactory'=> static function(MediaWikiServices $services):TtmServerFactory { $config=$services->getMainConfig();$default=$config->get( 'TranslateTranslationDefaultService');if( $default===false) { $default=null;} return new TtmServerFactory( $config->get( 'TranslateTranslationServices'), $default);}]
@phpcs-require-sorted-array