use closure to properly defer l10n initialization (#27328)

This commit is contained in:
Jörn Friedrich Dreyer 2017-03-08 00:19:24 +01:00 committed by Joas Schilling
parent f7cef9f702
commit fbd2dd49b6
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
5 changed files with 59 additions and 59 deletions

View File

@ -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'),

View File

@ -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);

View File

@ -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'),
];
});
}
}
}

View File

@ -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'),
];
});

View File

@ -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'),
];
});