diff --git a/apps/comments/lib/Activity/Provider.php b/apps/comments/lib/Activity/Provider.php index 9035087965..170b20d7c2 100644 --- a/apps/comments/lib/Activity/Provider.php +++ b/apps/comments/lib/Activity/Provider.php @@ -30,9 +30,13 @@ use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; +use OCP\L10N\IFactory; class Provider implements IProvider { + /** @var IFactory */ + protected $languageFactory; + /** @var IL10N */ protected $l; @@ -52,14 +56,14 @@ class Provider implements IProvider { protected $displayNames = []; /** - * @param IL10N $l + * @param IFactory $languageFactory * @param IURLGenerator $url * @param ICommentsManager $commentsManager * @param IUserManager $userManager * @param IManager $activityManager */ - public function __construct(IL10N $l, IURLGenerator $url, ICommentsManager $commentsManager, IUserManager $userManager, IManager $activityManager) { - $this->l = $l; + public function __construct(IFactory $languageFactory, IURLGenerator $url, ICommentsManager $commentsManager, IUserManager $userManager, IManager $activityManager) { + $this->languageFactory = $languageFactory; $this->url = $url; $this->commentsManager = $commentsManager; $this->userManager = $userManager; @@ -67,17 +71,20 @@ class Provider implements IProvider { } /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'comments') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('comments', $language); + if ($event->getSubject() === 'add_comment_subject') { $this->parseMessage($event); $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg'))); diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php index 2e2ce5bc27..d7730da61f 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php @@ -27,6 +27,7 @@ use OCP\Activity\IManager; use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUserManager; +use OCP\L10N\IFactory; class Calendar extends Base { @@ -38,6 +39,9 @@ class Calendar extends Base { const SUBJECT_UNSHARE_USER = 'calendar_user_unshare'; const SUBJECT_UNSHARE_GROUP = 'calendar_group_unshare'; + /** @var IFactory */ + protected $languageFactory; + /** @var IL10N */ protected $l; @@ -51,32 +55,35 @@ class Calendar extends Base { protected $eventMerger; /** - * @param IL10N $l + * @param IFactory $languageFactory * @param IURLGenerator $url * @param IManager $activityManager * @param IUserManager $userManager * @param IEventMerger $eventMerger */ - public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IEventMerger $eventMerger) { + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IEventMerger $eventMerger) { parent::__construct($userManager); - $this->l = $l; + $this->languageFactory = $languageFactory; $this->url = $url; $this->activityManager = $activityManager; $this->eventMerger = $eventMerger; } /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('dav', $language); + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); if ($event->getSubject() === self::SUBJECT_ADD) { diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Event.php b/apps/dav/lib/CalDAV/Activity/Provider/Event.php index 11c8d901ac..daaace6b5b 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Event.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Event.php @@ -27,6 +27,7 @@ use OCP\Activity\IManager; use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUserManager; +use OCP\L10N\IFactory; class Event extends Base { @@ -34,6 +35,9 @@ class Event extends Base { const SUBJECT_OBJECT_UPDATE = 'object_update'; const SUBJECT_OBJECT_DELETE = 'object_delete'; + /** @var IFactory */ + protected $languageFactory; + /** @var IL10N */ protected $l; @@ -47,32 +51,35 @@ class Event extends Base { protected $eventMerger; /** - * @param IL10N $l + * @param IFactory $languageFactory * @param IURLGenerator $url * @param IManager $activityManager * @param IUserManager $userManager * @param IEventMerger $eventMerger */ - public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IEventMerger $eventMerger) { + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IEventMerger $eventMerger) { parent::__construct($userManager); - $this->l = $l; + $this->languageFactory = $languageFactory; $this->url = $url; $this->activityManager = $activityManager; $this->eventMerger = $eventMerger; } /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_event') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('dav', $language); + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_event') { diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php index 43ab9e9c44..747b39ddb7 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php @@ -26,17 +26,20 @@ use OCP\Activity\IEvent; class Todo extends Event { /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_todo') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('dav', $language); + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg'))); if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo') { diff --git a/apps/files/lib/Activity/Provider.php b/apps/files/lib/Activity/Provider.php index 863e764405..92686ec0c3 100644 --- a/apps/files/lib/Activity/Provider.php +++ b/apps/files/lib/Activity/Provider.php @@ -29,9 +29,13 @@ use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; +use OCP\L10N\IFactory; class Provider implements IProvider { + /** @var IFactory */ + protected $languageFactory; + /** @var IL10N */ protected $l; @@ -51,14 +55,14 @@ class Provider implements IProvider { protected $displayNames = []; /** - * @param IL10N $l + * @param IFactory $languageFactory * @param IURLGenerator $url * @param IManager $activityManager * @param IUserManager $userManager * @param IEventMerger $eventMerger */ - public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IEventMerger $eventMerger) { - $this->l = $l; + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IEventMerger $eventMerger) { + $this->languageFactory = $languageFactory; $this->url = $url; $this->activityManager = $activityManager; $this->userManager = $userManager; @@ -66,17 +70,20 @@ class Provider implements IProvider { } /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'files') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('files', $language); + if ($this->activityManager->isFormattingFilteredObject()) { try { return $this->parseShortVersion($event, $previousEvent); diff --git a/apps/files_sharing/lib/Activity/Providers/Downloads.php b/apps/files_sharing/lib/Activity/Providers/Downloads.php index 39e2a846b3..e1a2515644 100644 --- a/apps/files_sharing/lib/Activity/Providers/Downloads.php +++ b/apps/files_sharing/lib/Activity/Providers/Downloads.php @@ -26,9 +26,13 @@ use OCP\Activity\IManager; use OCP\Activity\IProvider; use OCP\IL10N; use OCP\IURLGenerator; +use OCP\L10N\IFactory; class Downloads implements IProvider { + /** @var IFactory */ + protected $languageFactory; + /** @var IL10N */ protected $l; @@ -45,28 +49,31 @@ class Downloads implements IProvider { const SUBJECT_SHARED_FOLDER_BY_EMAIL_DOWNLOADED = 'folder_shared_with_email_downloaded'; /** - * @param IL10N $l + * @param IFactory $languageFactory * @param IURLGenerator $url * @param IManager $activityManager */ - public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager) { - $this->l = $l; + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager) { + $this->languageFactory = $languageFactory; $this->url = $url; $this->activityManager = $activityManager; } /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'files_sharing') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('files_sharing', $language); + if ($this->activityManager->isFormattingFilteredObject()) { try { return $this->parseShortVersion($event); diff --git a/apps/files_sharing/lib/Activity/Providers/Groups.php b/apps/files_sharing/lib/Activity/Providers/Groups.php index c42cc1bb59..326ebba9ef 100644 --- a/apps/files_sharing/lib/Activity/Providers/Groups.php +++ b/apps/files_sharing/lib/Activity/Providers/Groups.php @@ -28,9 +28,13 @@ use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; +use OCP\L10N\IFactory; class Groups implements IProvider { + /** @var IFactory */ + protected $languageFactory; + /** @var IL10N */ protected $l; @@ -53,30 +57,33 @@ class Groups implements IProvider { /** - * @param IL10N $l + * @param IFactory $languageFactory * @param IURLGenerator $url * @param IManager $activityManager * @param IUserManager $userManager */ - public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager) { - $this->l = $l; + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager) { + $this->languageFactory = $languageFactory; $this->url = $url; $this->activityManager = $activityManager; $this->userManager = $userManager; } /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'files_sharing') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('files_sharing', $language); + if ($this->activityManager->isFormattingFilteredObject()) { try { return $this->parseShortVersion($event); diff --git a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php index a1c6333a86..ec8152c5a3 100644 --- a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php +++ b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php @@ -28,9 +28,13 @@ use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; +use OCP\L10N\IFactory; class PublicLinks implements IProvider { + /** @var IFactory */ + protected $languageFactory; + /** @var IL10N */ protected $l; @@ -55,30 +59,33 @@ class PublicLinks implements IProvider { /** - * @param IL10N $l + * @param IFactory $languageFactory * @param IURLGenerator $url * @param IManager $activityManager * @param IUserManager $userManager */ - public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager) { - $this->l = $l; + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager) { + $this->languageFactory = $languageFactory; $this->url = $url; $this->activityManager = $activityManager; $this->userManager = $userManager; } /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'files_sharing') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('files_sharing', $language); + if ($this->activityManager->isFormattingFilteredObject()) { try { return $this->parseShortVersion($event); diff --git a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php index 8760733a26..3ee5d82e93 100644 --- a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php +++ b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php @@ -26,11 +26,13 @@ use OCP\Activity\IManager; use OCP\Activity\IProvider; use OCP\IL10N; use OCP\IURLGenerator; -use OCP\IUser; -use OCP\IUserManager; +use OCP\L10N\IFactory; class RemoteShares implements IProvider { + /** @var IFactory */ + protected $languageFactory; + /** @var IL10N */ protected $l; @@ -46,28 +48,31 @@ class RemoteShares implements IProvider { const SUBJECT_REMOTE_SHARE_UNSHARED = 'remote_share_unshared'; /** - * @param IL10N $l + * @param IFactory $languageFactory * @param IURLGenerator $url * @param IManager $activityManager */ - public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager) { - $this->l = $l; + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager) { + $this->languageFactory = $languageFactory; $this->url = $url; $this->activityManager = $activityManager; } /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'files_sharing') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('files_sharing', $language); + if ($this->activityManager->isFormattingFilteredObject()) { try { return $this->parseShortVersion($event); diff --git a/apps/files_sharing/lib/Activity/Providers/Users.php b/apps/files_sharing/lib/Activity/Providers/Users.php index c85452aec0..d85eeadc31 100644 --- a/apps/files_sharing/lib/Activity/Providers/Users.php +++ b/apps/files_sharing/lib/Activity/Providers/Users.php @@ -28,9 +28,13 @@ use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; +use OCP\L10N\IFactory; class Users implements IProvider { + /** @var IFactory */ + protected $languageFactory; + /** @var IL10N */ protected $l; @@ -55,30 +59,33 @@ class Users implements IProvider { const SUBJECT_UNSHARED_BY = 'unshared_by'; /** - * @param IL10N $l + * @param IFactory $languageFactory * @param IURLGenerator $url * @param IManager $activityManager * @param IUserManager $userManager */ - public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager) { - $this->l = $l; + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager) { + $this->languageFactory = $languageFactory; $this->url = $url; $this->activityManager = $activityManager; $this->userManager = $userManager; } /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'files_sharing') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('files_sharing', $language); + if ($this->activityManager->isFormattingFilteredObject()) { try { return $this->parseShortVersion($event); diff --git a/apps/sharebymail/lib/Activity.php b/apps/sharebymail/lib/Activity.php index 58ab0a5cdc..5342d013ad 100644 --- a/apps/sharebymail/lib/Activity.php +++ b/apps/sharebymail/lib/Activity.php @@ -29,9 +29,13 @@ use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; +use OCP\L10N\IFactory; class Activity implements IProvider { + /** @var IFactory */ + protected $languageFactory; + /** @var IL10N */ protected $l; @@ -56,14 +60,14 @@ class Activity implements IProvider { const SUBJECT_SHARED_EMAIL_BY = 'shared_with_email_by'; /** - * @param IL10N $l + * @param IFactory $languageFactory * @param IURLGenerator $url * @param IManager $activityManager * @param IUserManager $userManager * @param IContactsManager $contactsManager */ - public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IContactsManager $contactsManager) { - $this->l = $l; + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IContactsManager $contactsManager) { + $this->languageFactory = $languageFactory; $this->url = $url; $this->activityManager = $activityManager; $this->userManager = $userManager; @@ -71,17 +75,20 @@ class Activity implements IProvider { } /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'sharebymail') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('sharebymail', $language); + if ($this->activityManager->isFormattingFilteredObject()) { try { return $this->parseShortVersion($event); diff --git a/apps/systemtags/lib/Activity/Provider.php b/apps/systemtags/lib/Activity/Provider.php index 37ede8c3b8..5ef20c281b 100644 --- a/apps/systemtags/lib/Activity/Provider.php +++ b/apps/systemtags/lib/Activity/Provider.php @@ -28,6 +28,7 @@ use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; +use OCP\L10N\IFactory; class Provider implements IProvider { @@ -38,6 +39,9 @@ class Provider implements IProvider { const ASSIGN_TAG = 'assign_tag'; const UNASSIGN_TAG = 'unassign_tag'; + /** @var IFactory */ + protected $languageFactory; + /** @var IL10N */ protected $l; @@ -54,30 +58,33 @@ class Provider implements IProvider { protected $displayNames = []; /** - * @param IL10N $l + * @param IFactory $languageFactory * @param IURLGenerator $url * @param IManager $activityManager * @param IUserManager $userManager */ - public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager) { - $this->l = $l; + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager) { + $this->languageFactory = $languageFactory; $this->url = $url; $this->activityManager = $activityManager; $this->userManager = $userManager; } /** + * @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws \InvalidArgumentException * @since 11.0.0 */ - public function parse(IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== 'systemtags') { throw new \InvalidArgumentException(); } + $this->l = $this->languageFactory->get('systemtags', $language); + if ($this->activityManager->isFormattingFilteredObject()) { try { return $this->parseShortVersion($event);