From fbd2dd49b6a16a786c6d6da13e8065037577b7c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 8 Mar 2017 00:19:24 +0100 Subject: [PATCH] use closure to properly defer l10n initialization (#27328) --- apps/federatedfilesharing/appinfo/app.php | 4 +- apps/files_external/appinfo/app.php | 19 +++---- apps/files_sharing/appinfo/app.php | 60 +++++++++++------------ apps/files_trashbin/appinfo/app.php | 21 ++++---- apps/systemtags/appinfo/app.php | 14 +++--- 5 files changed, 59 insertions(+), 59 deletions(-) diff --git a/apps/federatedfilesharing/appinfo/app.php b/apps/federatedfilesharing/appinfo/app.php index 4a5492b0f1..b6a145bcc2 100644 --- a/apps/federatedfilesharing/appinfo/app.php +++ b/apps/federatedfilesharing/appinfo/app.php @@ -24,7 +24,6 @@ use OCA\FederatedFileSharing\Notifier; $app = new \OCA\FederatedFileSharing\AppInfo\Application(); -$l = \OC::$server->getL10N('files_sharing'); $eventDispatcher = \OC::$server->getEventDispatcher(); $app->registerSettings(); @@ -32,7 +31,8 @@ $app->registerSettings(); $manager = \OC::$server->getNotificationManager(); $manager->registerNotifier(function() { return \OC::$server->query(Notifier::class); -}, function() use ($l) { +}, function() { + $l = \OC::$server->getL10N('files_sharing'); return [ 'id' => 'files_sharing', 'name' => $l->t('Federated sharing'), diff --git a/apps/files_external/appinfo/app.php b/apps/files_external/appinfo/app.php index 3a90cf0c2c..925596198c 100644 --- a/apps/files_external/appinfo/app.php +++ b/apps/files_external/appinfo/app.php @@ -37,15 +37,16 @@ $appContainer = \OC_Mount_Config::$app->getContainer(); \OC_Mount_Config::$app->registerSettings(); -$l = \OC::$server->getL10N('files_external'); - -\OCA\Files\App::getNavigationManager()->add([ - "id" => 'extstoragemounts', - "appname" => 'files_external', - "script" => 'list.php', - "order" => 30, - "name" => $l->t('External storage') -]); +\OCA\Files\App::getNavigationManager()->add(function () { + $l = \OC::$server->getL10N('files_external'); + return [ + 'id' => 'extstoragemounts', + 'appname' => 'files_external', + 'script' => 'list.php', + 'order' => 30, + 'name' => $l->t('External storage'), + ]; +}); $mountProvider = $appContainer->query('OCA\Files_External\Config\ConfigAdapter'); \OC::$server->getMountProviderCollection()->registerProvider($mountProvider); diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index 4fed51b119..8228e76159 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -26,8 +26,6 @@ * */ -$l = \OC::$server->getL10N('files_sharing'); - \OCA\Files_Sharing\Helper::registerHooks(); \OCP\Share::registerBackend('file', 'OCA\Files_Sharing\ShareBackend\File'); @@ -52,39 +50,41 @@ $eventDispatcher->addListener( $config = \OC::$server->getConfig(); if ($config->getAppValue('core', 'shareapi_enabled', 'yes') === 'yes') { - - \OCA\Files\App::getNavigationManager()->add( - array( - "id" => 'sharingin', - "appname" => 'files_sharing', - "script" => 'list.php', - "order" => 10, - "name" => $l->t('Shared with you') - ) - ); + \OCA\Files\App::getNavigationManager()->add(function () { + $l = \OC::$server->getL10N('files_sharing'); + return [ + 'id' => 'sharingin', + 'appname' => 'files_sharing', + 'script' => 'list.php', + 'order' => 10, + 'name' => $l->t('Shared with you'), + ]; + }); if (\OCP\Util::isSharingDisabledForUser() === false) { + \OCA\Files\App::getNavigationManager()->add(function () { + $l = \OC::$server->getL10N('files_sharing'); + return [ + 'id' => 'sharingout', + 'appname' => 'files_sharing', + 'script' => 'list.php', + 'order' => 15, + 'name' => $l->t('Shared with others'), + ]; + }); - \OCA\Files\App::getNavigationManager()->add( - array( - "id" => 'sharingout', - "appname" => 'files_sharing', - "script" => 'list.php', - "order" => 15, - "name" => $l->t('Shared with others') - ) - ); // Check if sharing by link is enabled if ($config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes') { - \OCA\Files\App::getNavigationManager()->add( - array( - "id" => 'sharinglinks', - "appname" => 'files_sharing', - "script" => 'list.php', - "order" => 20, - "name" => $l->t('Shared by link') - ) - ); + \OCA\Files\App::getNavigationManager()->add(function () { + $l = \OC::$server->getL10N('files_sharing'); + return [ + 'id' => 'sharinglinks', + 'appname' => 'files_sharing', + 'script' => 'list.php', + 'order' => 20, + 'name' => $l->t('Shared by link'), + ]; + }); } } } diff --git a/apps/files_trashbin/appinfo/app.php b/apps/files_trashbin/appinfo/app.php index ed53657d22..d4e44b7885 100644 --- a/apps/files_trashbin/appinfo/app.php +++ b/apps/files_trashbin/appinfo/app.php @@ -25,17 +25,16 @@ * */ -$l = \OC::$server->getL10N('files_trashbin'); - // register hooks \OCA\Files_Trashbin\Trashbin::registerHooks(); -\OCA\Files\App::getNavigationManager()->add( -array( - "id" => 'trashbin', - "appname" => 'files_trashbin', - "script" => 'list.php', - "order" => 50, - "name" => $l->t('Deleted files') -) -); +\OCA\Files\App::getNavigationManager()->add(function () { + $l = \OC::$server->getL10N('files_trashbin'); + return [ + 'id' => 'trashbin', + 'appname' => 'files_trashbin', + 'script' => 'list.php', + 'order' => 50, + 'name' => $l->t('Deleted files'), + ]; +}); diff --git a/apps/systemtags/appinfo/app.php b/apps/systemtags/appinfo/app.php index 2c095753ce..bb2930e919 100644 --- a/apps/systemtags/appinfo/app.php +++ b/apps/systemtags/appinfo/app.php @@ -65,14 +65,14 @@ $mapperListener = function(MapperEvent $event) { $eventDispatcher->addListener(MapperEvent::EVENT_ASSIGN, $mapperListener); $eventDispatcher->addListener(MapperEvent::EVENT_UNASSIGN, $mapperListener); -$l = \OC::$server->getL10N('systemtags'); - -\OCA\Files\App::getNavigationManager()->add( - array( +\OCA\Files\App::getNavigationManager()->add(function () { + $l = \OC::$server->getL10N('systemtags'); + return [ 'id' => 'systemtagsfilter', 'appname' => 'systemtags', 'script' => 'list.php', 'order' => 25, - 'name' => $l->t('Tags') - ) -); + 'name' => $l->t('Tags'), + ]; +}); +