Skip to content

Commit

Permalink
Fix gettext reference in notifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
gmt2001 committed Sep 5, 2023
1 parent 043b8d3 commit ca38df5
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions pyouroboros/notifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,44 +39,44 @@ def build_apprise(self):
for notifier in self.config.notifiers:
add = apprise_obj.add(notifier)
if not add:
self.logger.error(_('Could not add notifier %s'), notifier)
self.logger.error(self._('Could not add notifier %s'), notifier)

return apprise_obj

def send(self, container_tuples=None, socket=None, kind='update', next_run=None, mode='container'):
if kind == 'startup':
title = _('Ouroboros has started')
title = self._('Ouroboros has started')
body_fields = [
_('Host: %s') % self.config.hostname,
_('Time: %s') % dates.format_datetime(None, format='full', tzinfo=timezone(self.config.tz), locale=self.config.language),
_('Next Run: %s') % dates.format_datetime(next_run, format='full', tzinfo=timezone(self.config.tz), locale=self.config.language)]
self._('Host: %s') % self.config.hostname,
self._('Time: %s') % dates.format_datetime(None, format='full', tzinfo=timezone(self.config.tz), locale=self.config.language),
self._('Next Run: %s') % dates.format_datetime(next_run, format='full', tzinfo=timezone(self.config.tz), locale=self.config.language)]
elif kind == 'monitor':
title = _('Ouroboros has detected updates!')
title = self._('Ouroboros has detected updates!')
body_fields = [
_('Host/Socket: %s / %s') % (self.config.hostname, socket.split('//')[1]),
_('Containers Monitored: %d') % self.data_manager.monitored_containers[socket],
_('Total Containers Updated: %d') % self.data_manager.total_updated[socket]
self._('Host/Socket: %s / %s') % (self.config.hostname, socket.split('//')[1]),
self._('Containers Monitored: %d') % self.data_manager.monitored_containers[socket],
self._('Total Containers Updated: %d') % self.data_manager.total_updated[socket]
]
body_fields.extend(
[
_("{} updated from {} to {}").format(
self._("{} updated from {} to {}").format(
container.name,
old_image if mode == 'service' else old_image.short_id.split(':')[1],
new_image.short_id.split(':')[1]
) for container, old_image, new_image in container_tuples
]
)
else:
title = _('Ouroboros has updated containers!')
title = self._('Ouroboros has updated containers!')
body_fields = [
_('Host/Socket: %s / %s') % (self.config.hostname, socket.split('//')[1]),
_('Containers Monitored: %d') % self.data_manager.monitored_containers[socket],
_('Total Containers Updated: %d') % self.data_manager.total_updated[socket],
_('Containers updated this pass: %d') % len(container_tuples)
self._('Host/Socket: %s / %s') % (self.config.hostname, socket.split('//')[1]),
self._('Containers Monitored: %d') % self.data_manager.monitored_containers[socket],
self._('Total Containers Updated: %d') % self.data_manager.total_updated[socket],
self._('Containers updated this pass: %d') % len(container_tuples)
]
body_fields.extend(
[
_("{} updated from {} to {}").format(
self._("{} updated from {} to {}").format(
container.name,
old_image if mode == 'service' else old_image.short_id.split(':')[1],
new_image.short_id.split(':')[1]
Expand Down

0 comments on commit ca38df5

Please sign in to comment.