From ece88ff6d4c59418dc043c735252aca012eee207 Mon Sep 17 00:00:00 2001 From: emkael Date: Sun, 12 Jun 2016 17:25:32 +0200 Subject: * localizing DB strings --- app/frontend/dto/BaseDTO.php | 15 +++++++++++++++ app/frontend/dto/CalendarDTO.php | 8 ++++++-- app/frontend/dto/CalendarGroupDTO.php | 8 ++++++-- app/frontend/dto/EventDTO.php | 8 ++++++-- 4 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 app/frontend/dto/BaseDTO.php (limited to 'app') diff --git a/app/frontend/dto/BaseDTO.php b/app/frontend/dto/BaseDTO.php new file mode 100644 index 0000000..ccb9df5 --- /dev/null +++ b/app/frontend/dto/BaseDTO.php @@ -0,0 +1,15 @@ +getModule('db-strings'); + if (!$module) { + return $string; + } + return $module->getTranslation($string, $category); + } + +} + +?> diff --git a/app/frontend/dto/CalendarDTO.php b/app/frontend/dto/CalendarDTO.php index 4468941..18b3767 100644 --- a/app/frontend/dto/CalendarDTO.php +++ b/app/frontend/dto/CalendarDTO.php @@ -1,8 +1,9 @@ ID = $calendarRecord->UID; - $this->Name = $calendarRecord->CustomName ?: $calendarRecord->Name; + $this->Name = self::getTranslation( + $calendarRecord->CustomName ?: $calendarRecord->Name, + 'Calendar.Name' + ); $this->Website = $calendarRecord->Website; $this->Image = $calendarRecord->CustomImageUrl; $this->Url = $calendarRecord->CustomUrl; diff --git a/app/frontend/dto/CalendarGroupDTO.php b/app/frontend/dto/CalendarGroupDTO.php index 7b64c6e..a607826 100644 --- a/app/frontend/dto/CalendarGroupDTO.php +++ b/app/frontend/dto/CalendarGroupDTO.php @@ -1,9 +1,10 @@ Name = $categoryRecord->Name; + $this->Name = self::getTranslation( + $categoryRecord->Name, + 'CalendarGroup.Name' + ); $this->ID = $categoryRecord->ID; $this->Priority = $categoryRecord->Priority; $this->Calendars = array_map( diff --git a/app/frontend/dto/EventDTO.php b/app/frontend/dto/EventDTO.php index 8f5cdf5..9af06e4 100644 --- a/app/frontend/dto/EventDTO.php +++ b/app/frontend/dto/EventDTO.php @@ -1,10 +1,11 @@ Name = $event->Name; + $this->Name = self::getTranslation( + $event->Name, + 'Event.Name' + ); $this->Location = $event->Location; if ($event->AllDay) { -- cgit v1.2.3