Skip to content

Commit

Permalink
(Host|Service)Controller: Use Translation trait method
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Jan 16, 2025
1 parent eb7a5c8 commit fa25876
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions application/controllers/HostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function init(): void
/** @var Host $host */
$host = $query->first();
if ($host === null) {
throw new NotFoundError(t('Host not found'));
throw new NotFoundError($this->translate('Host not found'));
}

$this->host = $host;
Expand Down Expand Up @@ -150,7 +150,7 @@ public function historyAction(): Generator
$sortControl = $this->createSortControl(
$history,
[
'history.event_time desc, history.event_type desc' => t('Event Time')
'history.event_time desc, history.event_type desc' => $this->translate('Event Time')
]
);
$viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl, true);
Expand Down Expand Up @@ -214,10 +214,10 @@ public function servicesAction(): Generator
$sortControl = $this->createSortControl(
$services,
[
'service.display_name' => t('Name'),
'service.state.severity desc,service.state.last_state_change desc' => t('Severity'),
'service.state.soft_state' => t('Current State'),
'service.state.last_state_change desc' => t('Last State Change')
'service.display_name' => $this->translate('Name'),
'service.state.severity desc,service.state.last_state_change desc' => $this->translate('Severity'),
'service.state.soft_state' => $this->translate('Current State'),
'service.state.last_state_change desc' => $this->translate('Last State Change')
]
);

Expand Down Expand Up @@ -449,15 +449,15 @@ protected function createTabs(): Tabs

$tabs = $this->getTabs()
->add('index', [
'label' => t('Host'),
'label' => $this->translate('Host'),
'url' => Links::host($this->host)
])
->add('services', [
'label' => t('Services'),
'label' => $this->translate('Services'),
'url' => HostLinks::services($this->host)
])
->add('history', [
'label' => t('History'),
'label' => $this->translate('History'),
'url' => HostLinks::history($this->host)
]);

Expand All @@ -473,7 +473,7 @@ protected function createTabs(): Tabs

if ($this->hasPermission('icingadb/object/show-source')) {
$tabs->add('source', [
'label' => t('Source'),
'label' => $this->translate('Source'),
'url' => Links::hostSource($this->host)
]);
}
Expand Down
12 changes: 6 additions & 6 deletions application/controllers/ServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function init(): void
/** @var Service $service */
$service = $query->first();
if ($service === null) {
throw new NotFoundError(t('Service not found'));
throw new NotFoundError($this->translate('Service not found'));
}

$this->service = $service;
Expand All @@ -86,7 +86,7 @@ public function init(): void

$this->setTitleTab($this->getRequest()->getActionName());
$this->setTitle(
t('%s on %s', '<service> on <host>'),
$this->translate('%s on %s', '<service> on <host>'),
$service->display_name,
$service->host->display_name
);
Expand Down Expand Up @@ -289,7 +289,7 @@ public function historyAction(): Generator
$sortControl = $this->createSortControl(
$history,
[
'history.event_time desc, history.event_type desc' => t('Event Time')
'history.event_time desc, history.event_type desc' => $this->translate('Event Time')
]
);
$viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl, true);
Expand Down Expand Up @@ -421,11 +421,11 @@ protected function createTabs(): Tabs

$tabs = $this->getTabs()
->add('index', [
'label' => t('Service'),
'label' => $this->translate('Service'),
'url' => Links::service($this->service, $this->service->host)
])
->add('history', [
'label' => t('History'),
'label' => $this->translate('History'),
'url' => ServiceLinks::history($this->service, $this->service->host)
]);

Expand All @@ -447,7 +447,7 @@ protected function createTabs(): Tabs

if ($this->hasPermission('icingadb/object/show-source')) {
$tabs->add('source', [
'label' => t('Source'),
'label' => $this->translate('Source'),
'url' => Links::serviceSource($this->service, $this->service->host)
]);
}
Expand Down

0 comments on commit fa25876

Please sign in to comment.