Comment 15 for bug 1799406

Revision history for this message
Corey Bryant (corey.bryant) wrote : Re: Alarms fail on Rocky

Is this a problem with oslo.i18n? The oslo_i18n._message.Message class defines translate() as:

  translate(self, desired_locale=None)

However, the Message class inherits from six.text_type which also has a translate() method but it takes a table (and optional deletechars) argument(s) rather than a locale:

  py2: str.translate(table[, deletechars])
  py3: str.translate(table)

  https://docs.python.org/2/library/stdtypes.html#str.translate
  https://docs.python.org/3/library/stdtypes.html#str.translate

Is this an unfortunate naming of the Message.translate() method or is it actually meant to override the base class method with different argument types?

From oslo_i18n/_message.py:
---------------------------

class Message(six.text_type):
    """A Message object is a unicode object that can be translated.
    ...

    def translate(self, desired_locale=None):
    """Translate this message to the desired locale.