From a4f82f13f396fc063643ab4a9dfcf17b52019332 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 20 Sep 2016 14:09:08 +0200 Subject: [PATCH] Translate the personal calendar Signed-off-by: Joas Schilling --- apps/dav/lib/CalDAV/CalDavBackend.php | 3 +++ apps/dav/lib/CalDAV/Calendar.php | 4 ++++ apps/dav/lib/HookManager.php | 6 +++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index d742061428..07b61285ec 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -59,6 +59,9 @@ use Sabre\VObject\Recur\EventIterator; */ class CalDavBackend extends AbstractBackend implements SyncSupport, SubscriptionSupport, SchedulingSupport { + const PERSONAL_CALENDAR_URI = 'personal'; + const PERSONAL_CALENDAR_NAME = 'Personal'; + /** * We need to specify a max date, because we need to stop *somewhere* * diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php index 3fbcd87acc..fc08c9ac87 100644 --- a/apps/dav/lib/CalDAV/Calendar.php +++ b/apps/dav/lib/CalDAV/Calendar.php @@ -38,6 +38,10 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { if ($this->getName() === BirthdayService::BIRTHDAY_CALENDAR_URI) { $this->calendarInfo['{DAV:}displayname'] = $l10n->t('Contact birthdays'); } + if ($this->getName() === CalDavBackend::PERSONAL_CALENDAR_URI && + $this->calendarInfo['{DAV:}displayname'] === CalDavBackend::PERSONAL_CALENDAR_NAME) { + $this->calendarInfo['{DAV:}displayname'] = $l10n->t('Personal'); + } } /** diff --git a/apps/dav/lib/HookManager.php b/apps/dav/lib/HookManager.php index 364db19d76..0ea5e47dd9 100644 --- a/apps/dav/lib/HookManager.php +++ b/apps/dav/lib/HookManager.php @@ -21,7 +21,6 @@ */ namespace OCA\DAV; -use OCA\DAV\CalDAV\BirthdayService; use OCA\DAV\CalDAV\CalDavBackend; use OCA\DAV\CardDAV\CardDavBackend; use OCA\DAV\CardDAV\SyncService; @@ -124,8 +123,9 @@ class HookManager { $principal = 'principals/users/' . $user->getUID(); if ($this->calDav->getCalendarsForUserCount($principal) === 0) { try { - $this->calDav->createCalendar($principal, 'personal', [ - '{DAV:}displayname' => 'Personal']); + $this->calDav->createCalendar($principal, CalDavBackend::PERSONAL_CALENDAR_URI, [ + '{DAV:}displayname' => CalDavBackend::PERSONAL_CALENDAR_NAME, + ]); } catch (\Exception $ex) { \OC::$server->getLogger()->logException($ex); }