From 3e6329838158892e3b89c7e5116fa313c282a8a1 Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Tue, 7 Feb 2023 14:13:04 +0100 Subject: feat(translations): Add translation provider API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- .../AppFramework/Bootstrap/RegistrationContext.php | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'lib/private/AppFramework/Bootstrap') diff --git a/lib/private/AppFramework/Bootstrap/RegistrationContext.php b/lib/private/AppFramework/Bootstrap/RegistrationContext.php index a78a895d029..9a6c298419a 100644 --- a/lib/private/AppFramework/Bootstrap/RegistrationContext.php +++ b/lib/private/AppFramework/Bootstrap/RegistrationContext.php @@ -34,6 +34,7 @@ use OCP\Calendar\Resource\IBackend as IResourceBackend; use OCP\Calendar\Room\IBackend as IRoomBackend; use OCP\Collaboration\Reference\IReferenceProvider; use OCP\Talk\ITalkBackend; +use OCP\Translation\ITranslationProvider; use RuntimeException; use function array_shift; use OC\Support\CrashReport\Registry; @@ -113,6 +114,9 @@ class RegistrationContext { /** @var ServiceRegistration[] */ private $templateProviders = []; + /** @var ServiceRegistration[] */ + private $translationProviders = []; + /** @var ServiceRegistration[] */ private $notifierServices = []; @@ -125,6 +129,9 @@ class RegistrationContext { /** @var ServiceRegistration[] */ private array $referenceProviders = []; + + + /** @var ParameterRegistration[] */ private $sensitiveMethods = []; @@ -252,6 +259,13 @@ class RegistrationContext { ); } + public function registerTranslationProvider(string $providerClass): void { + $this->context->registerTranslationProvider( + $this->appId, + $providerClass + ); + } + public function registerNotifierService(string $notifierClass): void { $this->context->registerNotifierService( $this->appId, @@ -404,6 +418,10 @@ class RegistrationContext { $this->templateProviders[] = new ServiceRegistration($appId, $class); } + public function registerTranslationProvider(string $appId, string $class): void { + $this->translationProviders[] = new ServiceRegistration($appId, $class); + } + public function registerNotifierService(string $appId, string $class): void { $this->notifierServices[] = new ServiceRegistration($appId, $class); } @@ -674,6 +692,13 @@ class RegistrationContext { return $this->templateProviders; } + /** + * @return ServiceRegistration[] + */ + public function getTranslationProviders(): array { + return $this->translationProviders; + } + /** * @return ServiceRegistration[] */ -- cgit v1.2.3