Skip to content

Commit

Permalink
fix inconsistent i18n log message
Browse files Browse the repository at this point in the history
An inconsistent example:
    imessage = _("Invalid metadata") + ": %(reason)s"
This is not consistent i18n usage. In most of cases, we use _() for
whole string instead of leaving something out.

More than inconsistent, some text in leaving strings may be not
translated, for example, ':' in English is different ':' in Chinese.

Change-Id: I00e690021c44f1debbe034cc0837a07b292ffd1b
Closes-Bug: #1220813
  • Loading branch information
Kun Huang committed Sep 4, 2013
1 parent 5319a2e commit 193ad79
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions cinder/exception.py
Expand Up @@ -106,7 +106,7 @@ def __unicode__(self):


class GlanceConnectionFailed(CinderException):
message = _("Connection to glance failed") + ": %(reason)s"
message = _("Connection to glance failed: %(reason)s")


class NotAuthorized(CinderException):
Expand All @@ -132,7 +132,7 @@ class Invalid(CinderException):


class InvalidSnapshot(Invalid):
message = _("Invalid snapshot") + ": %(reason)s"
message = _("Invalid snapshot: %(reason)s")


class InvalidSourceVolume(Invalid):
Expand Down Expand Up @@ -161,23 +161,23 @@ class InvalidResults(Invalid):


class InvalidInput(Invalid):
message = _("Invalid input received") + ": %(reason)s"
message = _("Invalid input received: %(reason)s")


class InvalidVolumeType(Invalid):
message = _("Invalid volume type") + ": %(reason)s"
message = _("Invalid volume type: %(reason)s")


class InvalidVolume(Invalid):
message = _("Invalid volume") + ": %(reason)s"
message = _("Invalid volume: %(reason)s")


class InvalidContentType(Invalid):
message = _("Invalid content type %(content_type)s.")


class InvalidHost(Invalid):
message = _("Invalid host") + ": %(reason)s"
message = _("Invalid host: %(reason)s")


# Cannot be templated as the error syntax varies.
Expand All @@ -187,7 +187,7 @@ class InvalidParameterValue(Invalid):


class InvalidAuthKey(Invalid):
message = _("Invalid auth key") + ": %(reason)s"
message = _("Invalid auth key: %(reason)s")


class ServiceUnavailable(Invalid):
Expand Down Expand Up @@ -240,11 +240,11 @@ class VolumeAdminMetadataNotFound(NotFound):


class InvalidVolumeMetadata(Invalid):
message = _("Invalid metadata") + ": %(reason)s"
message = _("Invalid metadata: %(reason)s")


class InvalidVolumeMetadataSize(Invalid):
message = _("Invalid metadata size") + ": %(reason)s"
message = _("Invalid metadata size: %(reason)s")


class SnapshotMetadataNotFound(NotFound):
Expand All @@ -253,11 +253,11 @@ class SnapshotMetadataNotFound(NotFound):


class InvalidSnapshotMetadata(Invalid):
message = _("Invalid metadata") + ": %(reason)s"
message = _("Invalid metadata: %(reason)s")


class InvalidSnapshotMetadataSize(Invalid):
message = _("Invalid metadata size") + ": %(reason)s"
message = _("Invalid metadata size: %(reason)s")


class VolumeTypeNotFound(NotFound):
Expand Down Expand Up @@ -399,7 +399,7 @@ class VolumeTypeEncryptionExists(Invalid):


class MigrationError(CinderException):
message = _("Migration error") + ": %(reason)s"
message = _("Migration error: %(reason)s")


class MalformedRequestBody(CinderException):
Expand Down Expand Up @@ -427,7 +427,7 @@ class WillNotSchedule(CinderException):


class QuotaError(CinderException):
message = _("Quota exceeded") + ": code=%(code)s"
message = _("Quota exceeded: code=%(code)s")
code = 413
headers = {'Retry-After': 0}
safe = True
Expand Down Expand Up @@ -598,23 +598,23 @@ class InvalidBackup(Invalid):


class SwiftConnectionFailed(CinderException):
message = _("Connection to swift failed") + ": %(reason)s"
message = _("Connection to swift failed: %(reason)s")


class TransferNotFound(NotFound):
message = _("Transfer %(transfer_id)s could not be found.")


class VolumeMigrationFailed(CinderException):
message = _("Volume migration failed") + ": %(reason)s"
message = _("Volume migration failed: %(reason)s")


class ProtocolNotSupported(CinderException):
message = _("Connect to volume via protocol %(protocol)s not supported.")


class SSHInjectionThreat(CinderException):
message = _("SSH command injection detected") + ": %(command)s"
message = _("SSH command injection detected: %(command)s")


class CoraidException(CinderException):
Expand Down Expand Up @@ -679,7 +679,7 @@ class QoSSpecsKeyNotFound(NotFound):


class InvalidQoSSpecs(Invalid):
message = _("Invalid qos specs") + ": %(reason)s"
message = _("Invalid qos specs: %(reason)s")


class QoSSpecsInUse(CinderException):
Expand Down

0 comments on commit 193ad79

Please sign in to comment.