]> git.ipfire.org Git - oddments/collecty.git/commitdiff
locales: Drop our custom module
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 28 Sep 2020 17:04:09 +0000 (17:04 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 28 Sep 2020 17:04:09 +0000 (17:04 +0000)
Gettext can handle this for us

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
16 files changed:
Makefile.am
src/collecty/locales.py [deleted file]
src/collecty/plugins/base.py
src/collecty/plugins/conntrack.py
src/collecty/plugins/contextswitches.py
src/collecty/plugins/cpufreq.py
src/collecty/plugins/df.py
src/collecty/plugins/disk.py
src/collecty/plugins/interface.py
src/collecty/plugins/interrupts.py
src/collecty/plugins/ipfrag.py
src/collecty/plugins/latency.py
src/collecty/plugins/loadavg.py
src/collecty/plugins/memory.py
src/collecty/plugins/processor.py
src/collecty/plugins/sensors.py

index 83110aceb6233681fa7d8ac58e14bd8ed6dc83ac..d4e355b95a8d1409af869592d0e7d160381c1154 100644 (file)
@@ -82,7 +82,6 @@ collecty_PYTHON = \
        src/collecty/daemon.py \
        src/collecty/errors.py \
        src/collecty/i18n.py \
-       src/collecty/locales.py \
        src/collecty/logger.py \
        src/collecty/util.py
 
diff --git a/src/collecty/locales.py b/src/collecty/locales.py
deleted file mode 100644 (file)
index c6051db..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/python3
-###############################################################################
-#                                                                             #
-# collecty - A system statistics collection daemon for IPFire                 #
-# Copyright (C) 2015 IPFire development team                                  #
-#                                                                             #
-# This program is free software: you can redistribute it and/or modify        #
-# it under the terms of the GNU General Public License as published by        #
-# the Free Software Foundation, either version 3 of the License, or           #
-# (at your option) any later version.                                         #
-#                                                                             #
-# This program is distributed in the hope that it will be useful,             #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
-# GNU General Public License for more details.                                #
-#                                                                             #
-# You should have received a copy of the GNU General Public License           #
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
-#                                                                             #
-###############################################################################
-
-import gettext
-import logging
-import os
-
-from .constants import *
-from .i18n import TEXTDOMAIN
-
-log = logging.getLogger("collecty.locale")
-
-DEFAULT_LOCALE = "en_US.utf-8"
-
-class Locale(object):
-       def __init__(self, lang):
-               self.lang = lang
-
-       def translate(self, message, plural_message=None, count=None):
-               if plural_message is not None:
-                       assert count is not None
-
-                       # Replace the message by the plural message if
-                       # we are using plural.
-                       if count > 1:
-                               message = plural_message
-
-               return message
-
-
-class GettextLocale(Locale):
-       def __init__(self, lang, translation):
-               Locale.__init__(self, lang)
-
-               self.translation = translation
-
-               # Bind gettext functions
-               self.gettext = self.translation.gettext
-               self.ngettext = self.translation.ngettext
-
-       def translate(self, message, plural_message=None, count=None):
-               if plural_message is not None:
-                       assert count is not None
-                       return self.ngettext(message, plural_message, count)
-
-               return self.gettext(message)
-
-
-def _find_all_locales(domain, directory):
-       locales = {
-               DEFAULT_LOCALE : Locale(DEFAULT_LOCALE),
-       }
-
-       for lang in os.listdir(directory):
-               if lang.startswith("."):
-                       continue
-
-               filename = os.path.join(directory, lang, "LC_MESSAGES",
-                       "%s.mo" % domain)
-
-               # Check if a translation file exists and go on if not
-               if not os.path.exists(filename):
-                       continue
-
-               try:
-                       translation = gettext.translation(domain,
-                               directory, languages=[lang])
-               except Exception as e:
-                       log.error("Cound not load translation for %s: %s" \
-                               % (lang, e))
-                       continue
-
-               locales[lang] = GettextLocale(lang, translation)
-
-       log.debug("Loaded translations: %s" % ", ".join(locales.keys()))
-
-       return locales
-
-_locales = _find_all_locales(TEXTDOMAIN, "/usr/share/locale")
-
-def get_supported_locales():
-       return list(_locales.keys())
-
-def get_closest(*langs):
-       for lang in langs:
-               if not lang:
-                       continue
-
-               lang = lang.replace("-", "_")
-               parts = lang.split("_")
-
-               if len(parts) > 2:
-                       continue
-
-               elif len(parts) == 2:
-                       parts[0] = parts[0].lower()
-                       parts[1] = parts[1].upper()
-                       lang = "_".join(parts)
-
-               for l in (lang, parts[0]):
-                       try:
-                               return _locales[l]
-                       except KeyError:
-                               pass
-
-def get(*langs):
-       return get_closest(*langs) or _locales.get(DEFAULT_LOCALE, None)
index 7c97aef54ebf97a44769975dda3ae68b0716d14a..8f122555dcd8e74751c2cb89d5a105168d3cf3c3 100644 (file)
@@ -26,7 +26,6 @@ import rrdtool
 import time
 import unicodedata
 
-from .. import locales
 from .. import util
 from ..constants import *
 from ..i18n import _
@@ -38,15 +37,14 @@ class Environment(object):
                Sets the correct environment for rrdtool to create
                localised graphs and graphs in the correct timezone.
        """
-       def __init__(self, timezone, locale):
+       def __init__(self, timezone="UTC", locale="en_US.utf-8"):
                # Build the new environment
                self.new_environment = {
-                       "TZ" : timezone or "UTC",
+                       "LANG"   : locale,
+                       "LC_ALL" : locale,
+                       "TZ"     : timezone,
                }
 
-               for k in ("LANG", "LC_ALL"):
-                       self.new_environment[k] = locale or "en_US.utf-8"
-
        def __enter__(self):
                # Save the current environment
                self.old_environment = {}
@@ -199,7 +197,8 @@ class Plugin(object, metaclass=PluginRegistration):
 
                time_start = time.time()
 
-               graph = template.generate_graph(**kwargs)
+               with Environment(timezone=timezone, locale=locale):
+                       graph = template.generate_graph(**kwargs)
 
                duration = time.time() - time_start
                self.log.debug(_("Generated graph %s in %.1fms") \
@@ -533,7 +532,7 @@ class GraphTemplate(object):
                self.plugin = plugin
 
                # Save localisation parameters
-               self.locale = locales.get(locale)
+               self.locale = locale
                self.timezone = timezone
 
                # Get all required RRD objects
@@ -692,8 +691,7 @@ class GraphTemplate(object):
                for arg in args:
                        self.log.debug("  %s" % arg)
 
-               with Environment(self.timezone, self.locale.lang):
-                       graph = rrdtool.graphv("-", *args)
+               graph = rrdtool.graphv("-", *args)
 
                return {
                        "image"        : graph.get("image"),
index 443c53fe6512f686b6c2261832e50fddfc2dec12..3191b551417e630b191af86b16ca22289bdc0602 100644 (file)
@@ -23,6 +23,7 @@ from . import base
 
 from ..colours import *
 from ..constants import *
+from ..i18n import _
 
 class ConntrackGraphTemplate(base.GraphTemplate):
        name = "conntrack"
@@ -31,8 +32,6 @@ class ConntrackGraphTemplate(base.GraphTemplate):
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                return [
                        "COMMENT:%s" % EMPTY_LABEL,
                        "COMMENT:%s" % (COLUMN % _("Current")),
@@ -58,14 +57,10 @@ class ConntrackGraphTemplate(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
-
                return _("Connection Tracking Table")
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
-
                return _("Entries")
 
 
index 519c3e0b70045103bbe057bd1f5390cc75d6e5d1..3bc84e21410b6a4e5e239675e5ee64f70e99989d 100644 (file)
@@ -25,14 +25,13 @@ from . import base
 
 from ..colours import *
 from ..constants import *
+from ..i18n import _
 
 class GraphTemplateContextSwitches(base.GraphTemplate):
        name = "context-switches"
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                return [
                        "COMMENT:%s" % EMPTY_LABEL,
                        "COMMENT:%s" % (COLUMN % _("Current")),
@@ -56,12 +55,10 @@ class GraphTemplateContextSwitches(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
                return _("Context Switches")
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
                return _("Context Switches/s")
 
 
index 638b6aa3363161c4b1874a8226f088308bffa695..266a57f4977006bb8935e7111224a1542dd3f241 100644 (file)
@@ -34,12 +34,10 @@ class GraphTemplateCPUFreq(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
                return _("Processor Frequencies")
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
                return "%s [%s]" % (_("Frequency"), _("Hz"))
 
        processor_colours = [
index 7fef88a550bbf79bcb607c1266782cdcfc4067fd..0c083bb5ebc1c2d5356d1f37c24c39e3d892c972 100644 (file)
@@ -26,6 +26,7 @@ from . import base
 
 from ..constants import *
 from ..colours import *
+from ..i18n import _
 
 class GraphTemplateDiskUsage(base.GraphTemplate):
        name = "disk-usage"
@@ -33,8 +34,6 @@ class GraphTemplateDiskUsage(base.GraphTemplate):
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                return [
                        "COMMENT:%s" % EMPTY_LABEL,
                        "COMMENT:%s" % (COLUMN % _("Current")),
@@ -69,12 +68,10 @@ class GraphTemplateDiskUsage(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
                return _("Disk Usage of %s") % self.object.mountpoint
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
                return _("Bytes")
 
 
@@ -84,8 +81,6 @@ class GraphTemplateInodeUsage(base.GraphTemplate):
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                rrd_graph = [
                        "COMMENT:%s" % EMPTY_LABEL,
                        "COMMENT:%s" % (COLUMN % _("Current")),
@@ -126,12 +121,10 @@ class GraphTemplateInodeUsage(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
                return _("Inode Usage of %s") % self.object.mountpoint
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
                return _("Inodes")
 
 
index 71ac02d8fbae4b5626d77648c250f5cf7e5a5f23..192598d9675e8ec5ac8363746c6c4d189687948b 100644 (file)
@@ -27,14 +27,13 @@ from . import base
 
 from ..colours import *
 from ..constants import *
+from ..i18n import _
 
 class GraphTemplateDiskBadSectors(base.GraphTemplate):
        name = "disk-bad-sectors"
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                return [
                        "COMMENT:%s" % EMPTY_LABEL,
                        "COMMENT:%s" % (COLUMN % _("Current")),
@@ -53,14 +52,10 @@ class GraphTemplateDiskBadSectors(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
-
                return _("Bad Sectors of %s") % self.object.device_string
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
-
                return _("Pending/Relocated Sectors")
 
 
@@ -69,8 +64,6 @@ class GraphTemplateDiskBytes(base.GraphTemplate):
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                rrd_graph = [
                        "CDEF:read_bytes=read_sectors,512,*",
                        "CDEF:write_bytes=write_sectors,512,*",
@@ -94,12 +87,10 @@ class GraphTemplateDiskBytes(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
                return _("Disk Utilisation of %s") % self.object.device_string
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
                return _("Byte per Second")
 
 
@@ -108,8 +99,6 @@ class GraphTemplateDiskIoOps(base.GraphTemplate):
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                rrd_graph = [
                        "LINE1:read_ios%s:%-15s" % (COLOUR_READ, _("Read")),
                        "GPRINT:read_ios_cur:%12s\:" % _("Current") + " %6.2lf",
@@ -130,12 +119,10 @@ class GraphTemplateDiskIoOps(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
                return _("Disk IO Operations of %s") % self.object.device_string
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
                return _("Operations per Second")
 
 
@@ -144,8 +131,6 @@ class GraphTemplateDiskTemperature(base.GraphTemplate):
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                rrd_graph = [
                        "CDEF:celsius=temperature,273.15,-",
                        "VDEF:temp_cur=celsius,LAST",
@@ -164,12 +149,10 @@ class GraphTemplateDiskTemperature(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
                return _("Disk Temperature of %s") % self.object.device_string
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
                return _("° Celsius")
 
        @property
index 6500fb06a0876bc98fdb4e9ff0d3cdc6aead519f..5cf9975d91a8d395fd7835a600e96ca6a967ba51 100644 (file)
@@ -26,6 +26,7 @@ from . import base
 
 from ..colours import *
 from ..constants import *
+from ..i18n import _
 
 class GraphTemplateInterfaceBase(base.GraphTemplate):
        @property
@@ -38,8 +39,6 @@ class GraphTemplateInterfaceBits(GraphTemplateInterfaceBase):
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                return [
                        # Headline
                        "COMMENT:%s" % EMPTY_LABEL,
@@ -92,14 +91,10 @@ class GraphTemplateInterfaceBits(GraphTemplateInterfaceBase):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
-
                return _("Bandwidth Usage on %s") % self.interface
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
-
                return _("Bit/s")
 
 
@@ -108,8 +103,6 @@ class GraphTemplateInterfacePackets(GraphTemplateInterfaceBase):
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                return [
                        # Headline
                        "COMMENT:%s" % EMPTY_LABEL,
@@ -145,13 +138,10 @@ class GraphTemplateInterfacePackets(GraphTemplateInterfaceBase):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
-
                return _("Transferred Packets on %s") % self.interface
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
                return _("Packets/s")
 
 
@@ -160,8 +150,6 @@ class GraphTemplateInterfaceErrors(GraphTemplateInterfaceBase):
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                return [
                        # Headline
                        "COMMENT:%s" % EMPTY_LABEL,
@@ -233,14 +221,10 @@ class GraphTemplateInterfaceErrors(GraphTemplateInterfaceBase):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
-
                return _("Errors/Dropped Packets on %s") % self.interface
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
-
                return _("Packets/s")
 
 
index e616356474790080d8ad43adf408bbc15ab64b1e..e58a328512a2ec79a67dba4a1bb338c92ffb0f9b 100644 (file)
@@ -26,14 +26,13 @@ from . import base
 
 from ..colours import *
 from ..constants import *
+from ..i18n import _
 
 class GraphTemplateInterrupts(base.GraphTemplate):
        name = "interrupts"
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                return [
                        # Headline
                        "COMMENT:%s" % EMPTY_LABEL,
@@ -57,8 +56,6 @@ class GraphTemplateInterrupts(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
-
                if self.object.irq is None:
                        return _("Interrupts")
 
@@ -66,8 +63,6 @@ class GraphTemplateInterrupts(base.GraphTemplate):
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
-
                return _("Interrupts/s")
 
 
index fb27b05b21413a275bf5da1b485cc99be9e6c5b1..0d6f9354c471374f9065149363405ece805d6e4a 100644 (file)
@@ -26,14 +26,13 @@ from . import base
 
 from ..colours import *
 from ..constants import *
+from ..i18n import _
 
 class GraphTemplateIPv6Fragmentation(base.GraphTemplate):
        name = "ipv6-fragmentation"
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                return [
                        "CDEF:ip6_reasm_real_fails=ip6_reasm_fails,ip6_reasm_timeout,-",
 
@@ -96,8 +95,6 @@ class GraphTemplateIPv6Fragmentation(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
-
                if self.object.interface:
                        return _("IPv6 Fragmentation on %s") % self.object.interface
 
@@ -105,8 +102,6 @@ class GraphTemplateIPv6Fragmentation(base.GraphTemplate):
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
-
                return _("Packets/s")
 
        @property
@@ -122,8 +117,6 @@ class GraphTemplateIPv4Fragmentation(base.GraphTemplate):
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                return [
                        "CDEF:ip4_reasm_real_fails=ip4_reasm_fails,ip4_reasm_timeout,-",
 
@@ -186,8 +179,6 @@ class GraphTemplateIPv4Fragmentation(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
-
                if self.object.interface:
                        return _("IPv4 Fragmentation on %s") % self.object.interface
 
@@ -195,7 +186,6 @@ class GraphTemplateIPv4Fragmentation(base.GraphTemplate):
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
                return _("Packets/s")
 
        @property
index 3334782d77560bbacf0331922a4bf7a05dd19cb0..27cdc668290393ae80ad2b1d58441c0a40b5880d 100644 (file)
 import socket
 
 from .. import _collecty
-from ..i18n import _
 from . import base
 
 from ..colours import *
 from ..constants import *
+from ..i18n import _
 
 PING_HOSTS = [
        # gateway is a special name that is automatically
@@ -44,8 +44,6 @@ class GraphTemplateLatency(base.GraphTemplate):
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                return [
                        # Compute the biggest loss and convert into percentage
                        "CDEF:ploss=loss6,loss4,MAX,100,*",
@@ -121,8 +119,6 @@ class GraphTemplateLatency(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
-
                if self.object.hostname == "gateway":
                        hostname = _("Default Gateway")
                else:
@@ -132,7 +128,6 @@ class GraphTemplateLatency(base.GraphTemplate):
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
                return _("Milliseconds")
 
        @property
index bcdbf62be59f4047ad1bca7031d167bff68e9146..3a786a632d902b10be5688192b49771a53ff3634 100644 (file)
@@ -25,14 +25,13 @@ from . import base
 
 from ..colours import *
 from ..constants import *
+from ..i18n import _
 
 class GraphTemplateLoadAvg(base.GraphTemplate):
        name = "loadavg"
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                rrd_graph = [
                        "LINE2:load15%s:%s" % (
                                YELLOW, LABEL % _("15 Minutes"),
@@ -72,14 +71,10 @@ class GraphTemplateLoadAvg(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
-
                return _("Load Average")
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
-
                return _("Load")
 
        @property
index e16205c177f7a036bef2ded2abed72f84fba59ca..786acc4fd95ebcdfb6050675aa49ac512693d518 100644 (file)
@@ -23,6 +23,7 @@ from . import base
 
 from ..colours import *
 from ..constants import *
+from ..i18n import _
 
 class GraphTemplateMemory(base.GraphTemplate):
        name = "memory"
@@ -31,8 +32,6 @@ class GraphTemplateMemory(base.GraphTemplate):
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                return [
                        # Headline
                        "COMMENT:%s" % EMPTY_LABEL,
@@ -104,14 +103,10 @@ class GraphTemplateMemory(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
-
                return _("Memory Usage")
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
-
                return _("Bytes")
 
 
index 97d71e1b93ef470699c68067871db1b618265ee6..8b7f7e9b90193e9a652b1a2078fbde66ca469835 100644 (file)
@@ -25,14 +25,13 @@ from . import base
 
 from ..colours import *
 from ..constants import *
+from ..i18n import _
 
 class GraphTemplateProcessor(base.GraphTemplate):
        name = "processor"
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                return [
                        # Add all used CPU cycles
                        "CDEF:usage=user,nice,+,sys,+,wait,+,irq,+,sirq,+,steal,+,guest,+,guest_nice,+",
@@ -166,12 +165,10 @@ class GraphTemplateProcessor(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
                return _("Processor Usage")
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
                return _("Percent")
 
 
index 684a03fffaaca6b23e499bd60ed1afe30e8bc492..da244d2871459bd83efc2e793c518724580f79b9 100644 (file)
@@ -25,14 +25,13 @@ import re
 
 from .. import _collecty
 from . import base
+from ..i18n import _
 
 class GraphTemplateSensorsTemperature(base.GraphTemplate):
        name = "sensors-temperature"
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
-
                return [
                        # Convert everything to Celsius
                        "CDEF:value_c=value,273.15,-",
@@ -71,12 +70,10 @@ class GraphTemplateSensorsTemperature(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
                return _("Temperature (%s)") % self.object.sensor.name
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
                return _("° Celsius")
 
 
@@ -107,7 +104,6 @@ class GraphTemplateSensorsProcessorTemperature(base.GraphTemplate):
 
        @property
        def rrd_graph(self):
-               _ = self.locale.translate
                rrd_graph = []
 
                counter = 0
@@ -170,12 +166,10 @@ class GraphTemplateSensorsProcessorTemperature(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               _ = self.locale.translate
                return _("Processor")
 
        @property
        def graph_vertical_label(self):
-               _ = self.locale.translate
                return _("Temperature")