Skip to content

Commit

Permalink
use closure to properly defer l10n initialization (#27328)
Browse files Browse the repository at this point in the history
  • Loading branch information
butonic authored and DeepDiver1975 committed Mar 7, 2017
1 parent 238f1ea commit 8e36c55
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 59 deletions.
5 changes: 2 additions & 3 deletions apps/federatedfilesharing/appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@

use OCA\FederatedFileSharing\Notifier;

$l = \OC::$server->getL10N('files_sharing');

$manager = \OC::$server->getNotificationManager();
$manager->registerNotifier(function() {
return new Notifier(
\OC::$server->getL10NFactory()
);
}, function() use ($l) {
}, function() {
$l = \OC::$server->getL10N('files_sharing');
return [
'id' => 'files_sharing',
'name' => $l->t('Federated sharing'),
Expand Down
20 changes: 10 additions & 10 deletions apps/files_external/appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
\OC_Mount_Config::$app = new \OCA\Files_External\AppInfo\Application();
$appContainer = \OC_Mount_Config::$app->getContainer();

$l = \OC::$server->getL10N('files_external');

$config = \OC::$server->getConfig();
if ($config->getAppValue('core', 'enable_external_storage', 'no') === 'yes') {
\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'),
];
});
}

59 changes: 30 additions & 29 deletions apps/files_sharing/appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
*
*/

$l = \OC::$server->getL10N('files_sharing');

\OCA\Files_Sharing\Helper::registerHooks();

\OCP\Share::registerBackend('file', 'OCA\Files_Sharing\ShareBackend\File');
Expand Down Expand Up @@ -63,38 +61,41 @@ function() {
$config = \OC::$server->getConfig();
if ($config->getAppValue('core', 'shareapi_enabled', 'yes') === 'yes') {

\OCA\Files\App::getNavigationManager()->add(
[
"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(
[
"id" => 'sharingout',
"appname" => 'files_sharing',
"script" => 'list.php',
"order" => 15,
"name" => $l->t('Shared with others')
]
);
\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'),
];
});
// Check if sharing by link is enabled
if ($config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes') {
\OCA\Files\App::getNavigationManager()->add(
[
"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'),
];
});
}
}
}
21 changes: 10 additions & 11 deletions apps/files_trashbin/appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,16 @@
*
*/

$l = \OC::$server->getL10N('files_trashbin');

// register hooks
\OCA\Files_Trashbin\Trashbin::registerHooks();

\OCA\Files\App::getNavigationManager()->add(
[
"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'),
];
});
11 changes: 5 additions & 6 deletions apps/systemtags/appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,13 @@ function() {
$eventDispatcher->addListener(MapperEvent::EVENT_ASSIGN, $mapperListener);
$eventDispatcher->addListener(MapperEvent::EVENT_UNASSIGN, $mapperListener);

$l = \OC::$server->getL10N('systemtags');

\OCA\Files\App::getNavigationManager()->add(
[
\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')
]
);
];
});

0 comments on commit 8e36c55

Please sign in to comment.