From 845851245a41241c617e7eac5a70e45baae9b131 Mon Sep 17 00:00:00 2001 From: Trevor McCasland Date: Mon, 5 Dec 2016 07:47:42 -0600 Subject: [PATCH] Add i18n translation to extenstions 1/3 This is 1 of 3 patches to add translation to the extensions directory and some other files. Custom hacking rules will be added later to enforce this style. Change-Id: Iddd738c2d9a7c9a57fcd445650d087123dbccfc4 --- trove/configuration/models.py | 4 ++-- trove/dns/designate/driver.py | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/trove/configuration/models.py b/trove/configuration/models.py index 5935f34aa9..7a240cb5c0 100644 --- a/trove/configuration/models.py +++ b/trove/configuration/models.py @@ -39,9 +39,9 @@ class Configurations(object): @staticmethod def load(context): if context is None: - raise TypeError("Argument context not defined.") + raise TypeError(_("Argument context not defined.")) elif id is None: - raise TypeError("Argument is not defined.") + raise TypeError(_("Argument is not defined.")) if context.is_admin: db_info = DBConfiguration.find_all(deleted=False) diff --git a/trove/dns/designate/driver.py b/trove/dns/designate/driver.py index b8de297c3b..35cc38b710 100644 --- a/trove/dns/designate/driver.py +++ b/trove/dns/designate/driver.py @@ -28,6 +28,7 @@ import six from trove.common import cfg from trove.common import exception +from trove.common.i18n import _ from trove.dns import driver @@ -83,7 +84,8 @@ class DesignateDriver(driver.DnsDriver): """Creates the entry in the driver at the given dns zone.""" dns_zone = entry.dns_zone or self.default_dns_zone if not dns_zone.id: - raise TypeError("The entry's dns_zone must have an ID specified.") + raise TypeError(_("The entry's dns_zone must have an ID " + "specified.")) name = entry.name LOG.debug("Creating DNS entry %s." % name) client = self.dns_client @@ -125,16 +127,16 @@ class DesignateDriver(driver.DnsDriver): def modify_content(self, name, content, dns_zone): # We dont need this in trove for now - raise NotImplementedError("Not implemented for Designate DNS.") + raise NotImplementedError(_("Not implemented for Designate DNS.")) def rename_entry(self, content, name, dns_zone): # We dont need this in trove for now - raise NotImplementedError("Not implemented for Designate DNS.") + raise NotImplementedError(_("Not implemented for Designate DNS.")) def _get_records(self, dns_zone): dns_zone = dns_zone or self.default_dns_zone if not dns_zone: - raise TypeError('DNS domain is must be specified') + raise TypeError(_('DNS domain is must be specified')) return self.dns_client.records.list(dns_zone.id)