diff options
author | Julius Härtl <jus@bitgrid.net> | 2023-02-07 14:13:04 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2023-02-27 16:52:03 +0100 |
commit | 3e6329838158892e3b89c7e5116fa313c282a8a1 (patch) | |
tree | 0e55e55fc3053b1263cf3a39fdfa25665fe3388e /lib/private/AppFramework/Bootstrap | |
parent | 0d67fc23f4077e7b06a01bc519957f3f13d95f10 (diff) | |
download | nextcloud-server-3e6329838158892e3b89c7e5116fa313c282a8a1.tar.gz nextcloud-server-3e6329838158892e3b89c7e5116fa313c282a8a1.zip |
feat(translations): Add translation provider API
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/AppFramework/Bootstrap')
-rw-r--r-- | lib/private/AppFramework/Bootstrap/RegistrationContext.php | 25 |
1 files changed, 25 insertions, 0 deletions
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<ICustomTemplateProvider>[] */ private $templateProviders = []; + /** @var ServiceRegistration<ITranslationProvider>[] */ + private $translationProviders = []; + /** @var ServiceRegistration<INotifier>[] */ private $notifierServices = []; @@ -125,6 +129,9 @@ class RegistrationContext { /** @var ServiceRegistration<IReferenceProvider>[] */ 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); } @@ -675,6 +693,13 @@ class RegistrationContext { } /** + * @return ServiceRegistration<ITranslationProvider>[] + */ + public function getTranslationProviders(): array { + return $this->translationProviders; + } + + /** * @return ServiceRegistration<INotifier>[] */ public function getNotifierServices(): array { |