diff options
Diffstat (limited to 'MLEB/Translate/src/Services.php')
-rw-r--r-- | MLEB/Translate/src/Services.php | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/MLEB/Translate/src/Services.php b/MLEB/Translate/src/Services.php index 2c843239..0560940d 100644 --- a/MLEB/Translate/src/Services.php +++ b/MLEB/Translate/src/Services.php @@ -1,19 +1,20 @@ <?php -/** - * @file - * @author Niklas Laxström - * @license GPL-2.0-or-later - */ +declare( strict_types = 1 ); + namespace MediaWiki\Extension\Translate; use MediaWiki\Extension\Translate\Cache\PersistentCache; use MediaWiki\Extension\Translate\PageTranslation\TranslatablePageMover; use MediaWiki\Extension\Translate\PageTranslation\TranslatablePageParser; +use MediaWiki\Extension\Translate\PageTranslation\TranslationUnitStoreFactory; use MediaWiki\Extension\Translate\Statistics\TranslationStatsDataProvider; use MediaWiki\Extension\Translate\Statistics\TranslatorActivity; +use MediaWiki\Extension\Translate\Synchronization\ExternalMessageSourceStateImporter; use MediaWiki\Extension\Translate\Synchronization\GroupSynchronizationCache; +use MediaWiki\Extension\Translate\TranslatorInterface\EntitySearch; use MediaWiki\Extension\Translate\TranslatorSandbox\TranslationStashReader; use MediaWiki\Extension\Translate\TtmServer\TtmServerFactory; +use MediaWiki\Extension\Translate\Utilities\ConfigHelper; use MediaWiki\Extension\Translate\Utilities\Json\JsonCodec; use MediaWiki\Extension\Translate\Utilities\ParsingPlaceholderFactory; use MediaWiki\MediaWikiServices; @@ -24,11 +25,11 @@ use Psr\Container\ContainerInterface; * * Main purpose is to give type-hinted getters for services defined in this extensions. * + * @author Niklas Laxström + * @license GPL-2.0-or-later * @since 2020.04 */ class Services implements ContainerInterface { - /** @var self */ - private static $instance; /** @var ContainerInterface */ private $container; @@ -37,8 +38,7 @@ class Services implements ContainerInterface { } public static function getInstance(): Services { - self::$instance = self::$instance ?? new self( MediaWikiServices::getInstance() ); - return self::$instance; + return new self( MediaWikiServices::getInstance() ); } /** @inheritDoc */ @@ -51,6 +51,19 @@ class Services implements ContainerInterface { return $this->container->has( $id ); } + public function getConfigHelper(): ConfigHelper { + return $this->get( 'Translate:ConfigHelper' ); + } + + /** @since 2021.10 */ + public function getEntitySearch(): EntitySearch { + return $this->get( 'Translate:EntitySearch' ); + } + + public function getExternalMessageSourceStateImporter(): ExternalMessageSourceStateImporter { + return $this->get( 'Translate:ExternalMessageSourceStateImporter' ); + } + public function getGroupSynchronizationCache(): GroupSynchronizationCache { return $this->get( 'Translate:GroupSynchronizationCache' ); } @@ -89,6 +102,11 @@ class Services implements ContainerInterface { return $this->get( 'Translate:TranslationStatsDataProvider' ); } + /** @since 2021.05 */ + public function getTranslationUnitStoreFactory(): TranslationUnitStoreFactory { + return $this->get( 'Translate:TranslationUnitStoreFactory' ); + } + public function getTranslatorActivity(): TranslatorActivity { return $this->get( 'Translate:TranslatorActivity' ); } @@ -98,5 +116,3 @@ class Services implements ContainerInterface { return $this->get( 'Translate:TtmServerFactory' ); } } - -class_alias( Services::class, '\MediaWiki\Extensions\Translate\Services' ); |