summaryrefslogtreecommitdiff
path: root/keystoneclient/common
diff options
context:
space:
mode:
authorBrant Knudson <bknudson@us.ibm.com>2014-10-27 10:54:48 -0500
committerJamie Lennox <jamielennox@redhat.com>2014-10-28 20:33:19 +0000
commitfece74ca3e56342bee43f561404c19128a613628 (patch)
tree7241c8dcb7f3176da3df660dbfb5006f9eb86fc1 /keystoneclient/common
parent3b766c51438396a0ab0032de309c9d56e275e0cb (diff)
downloadpython-keystoneclient-fece74ca3e56342bee43f561404c19128a613628.tar.gz
I18n
Keystoneclient didn't provide translated messages. With this change, the messages are marked for translation. DocImpact Implements: blueprint keystoneclient-i18n Change-Id: I85263a71671a1dffed524185266e6bb7ae559630
Diffstat (limited to 'keystoneclient/common')
-rw-r--r--keystoneclient/common/cms.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/keystoneclient/common/cms.py b/keystoneclient/common/cms.py
index 343b303..6e40b18 100644
--- a/keystoneclient/common/cms.py
+++ b/keystoneclient/common/cms.py
@@ -28,6 +28,7 @@ import zlib
import six
from keystoneclient import exceptions
+from keystoneclient.i18n import _, _LE, _LW
subprocess = None
@@ -73,8 +74,9 @@ def _check_files_accessible(files):
except IOError as e:
# Catching IOError means there is an issue with
# the given file.
- err = ('Hit OSError in _process_communicate_handle_oserror()\n'
- 'Likely due to %s: %s') % (try_file, e.strerror)
+ err = _('Hit OSError in _process_communicate_handle_oserror()\n'
+ 'Likely due to %(file)s: %(error)s') % {'file': try_file,
+ 'error': e.strerror}
# Emulate openssl behavior, which returns with code 2 when
# access to a file failed:
@@ -122,8 +124,9 @@ def _encoding_for_form(inform):
elif inform == PKIZ_CMS_FORM:
encoding = 'hex'
else:
- raise ValueError('"inform" must be either %s or %s' %
- (PKI_ASN1_FORM, PKIZ_CMS_FORM))
+ raise ValueError(
+ _('"inform" must be one of: %s') % ','.join((PKI_ASN1_FORM,
+ PKIZ_CMS_FORM)))
return encoding
@@ -296,8 +299,8 @@ def is_asn1_token(token):
def is_ans1_token(token):
"""Deprecated. Use is_asn1_token() instead."""
- LOG.warning('The function is_ans1_token() is deprecated, '
- 'use is_asn1_token() instead.')
+ LOG.warning(_LW('The function is_ans1_token() is deprecated, '
+ 'use is_asn1_token() instead.'))
return is_asn1_token(token)
@@ -344,13 +347,13 @@ def cms_sign_data(data_to_sign, signing_cert_file_name, signing_key_file_name,
process, data, (signing_cert_file_name, signing_key_file_name))
if retcode or ('Error' in err):
- LOG.error('Signing error: %s', err)
+ LOG.error(_LE('Signing error: %s'), err)
if retcode == 3:
- LOG.error('Signing error: Unable to load certificate - '
- 'ensure you have configured PKI with '
- '"keystone-manage pki_setup"')
+ LOG.error(_LE('Signing error: Unable to load certificate - '
+ 'ensure you have configured PKI with '
+ '"keystone-manage pki_setup"'))
else:
- LOG.error('Signing error: %s', err)
+ LOG.error(_LE('Signing error: %s'), err)
raise subprocess.CalledProcessError(retcode, 'openssl')
if outform == PKI_ASN1_FORM:
return output.decode('utf-8')