From bcac7d17b8da20a6a0e0041a0d1eae40b43023be Mon Sep 17 00:00:00 2001 From: ZhiQiang Fan Date: Mon, 23 Dec 2013 23:23:05 +0800 Subject: [PATCH] Fix broken i18n support In notification and publisher.rpc module, there are some log messages don't support i18n, this patch fixes them. NOTE: rename unused variable from _ to n, because it will overshadow global _ of gettext. Change-Id: Ic703fe6536234f4d51a84f4a3b2e04049ec6f3b5 Closes-Bug: #1263711 --- ceilometer/notification.py | 4 ++-- ceilometer/publisher/rpc.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ceilometer/notification.py b/ceilometer/notification.py index 62f1c793a..1eb135e11 100644 --- a/ceilometer/notification.py +++ b/ceilometer/notification.py @@ -73,7 +73,7 @@ class NotificationService(service.DispatchedService, rpc_service.Service): ), ) - LOG.debug('loading event definitions') + LOG.debug(_('Loading event definitions')) self.event_converter = event_converter.setup_events( extension.ExtensionManager( namespace='ceilometer.event.trait_plugin')) @@ -148,7 +148,7 @@ class NotificationService(service.DispatchedService, rpc_service.Service): event = self.event_converter.to_event(body) if event is not None: - LOG.debug('Saving event "%s"', event.event_type) + LOG.debug(_('Saving event "%s"'), event.event_type) problem_events = [] for dispatcher in self.dispatcher_manager: problem_events.extend(dispatcher.obj.record_events(event)) diff --git a/ceilometer/publisher/rpc.py b/ceilometer/publisher/rpc.py index 04570be46..2a20b2b34 100644 --- a/ceilometer/publisher/rpc.py +++ b/ceilometer/publisher/rpc.py @@ -250,13 +250,13 @@ class RPCPublisher(publisher.PublisherBase): try: rpc.cast(context, topic, msg) except (SystemExit, rpc.common.RPCException): - samples = sum([len(m['args']['data']) for _, _, m in queue]) + samples = sum([len(m['args']['data']) for n, n, m in queue]) if policy == 'queue': - LOG.warn("Failed to publish %s samples, queue them", + LOG.warn(_("Failed to publish %d samples, queue them"), samples) return queue elif policy == 'drop': - LOG.warn("Failed to publish %d samples, dropping them", + LOG.warn(_("Failed to publish %d samples, dropping them"), samples) return [] # default, occur only if rabbit_max_retries > 0