3636import openstackclient
3737from openstackclient .common import clientmanager
3838from openstackclient .common import commandmanager
39+ from openstackclient .i18n import _
3940
4041from os_client_config import config as cloud_config
4142
@@ -63,9 +64,8 @@ def prompt_for_password(prompt=None):
6364 pass
6465 # No password because we did't have a tty or nothing was entered
6566 if not pw :
66- raise exc .CommandError (
67- "No password entered, or found via --os-password or OS_PASSWORD" ,
68- )
67+ raise exc .CommandError (_ ("No password entered, or found via"
68+ " --os-password or OS_PASSWORD" ),)
6969 return pw
7070
7171
@@ -185,45 +185,49 @@ def build_option_parser(self, description, version):
185185 metavar = '<cloud-config-name>' ,
186186 dest = 'cloud' ,
187187 default = utils .env ('OS_CLOUD' ),
188- help = 'Cloud name in clouds.yaml (Env: OS_CLOUD)' ,
188+ help = _ ( 'Cloud name in clouds.yaml (Env: OS_CLOUD)' ) ,
189189 )
190190 # Global arguments
191191 parser .add_argument (
192192 '--os-region-name' ,
193193 metavar = '<auth-region-name>' ,
194194 dest = 'region_name' ,
195195 default = utils .env ('OS_REGION_NAME' ),
196- help = 'Authentication region name (Env: OS_REGION_NAME)' )
196+ help = _ ('Authentication region name (Env: OS_REGION_NAME)' ),
197+ )
197198 parser .add_argument (
198199 '--os-cacert' ,
199200 metavar = '<ca-bundle-file>' ,
200201 dest = 'cacert' ,
201202 default = utils .env ('OS_CACERT' ),
202- help = 'CA certificate bundle file (Env: OS_CACERT)' )
203+ help = _ ('CA certificate bundle file (Env: OS_CACERT)' ),
204+ )
203205 parser .add_argument (
204206 '--os-cert' ,
205207 metavar = '<certificate-file>' ,
206208 dest = 'cert' ,
207209 default = utils .env ('OS_CERT' ),
208- help = 'Client certificate bundle file (Env: OS_CERT)' )
210+ help = _ ('Client certificate bundle file (Env: OS_CERT)' ),
211+ )
209212 parser .add_argument (
210213 '--os-key' ,
211214 metavar = '<key-file>' ,
212215 dest = 'key' ,
213216 default = utils .env ('OS_KEY' ),
214- help = 'Client certificate key file (Env: OS_KEY)' )
217+ help = _ ('Client certificate key file (Env: OS_KEY)' ),
218+ )
215219 verify_group = parser .add_mutually_exclusive_group ()
216220 verify_group .add_argument (
217221 '--verify' ,
218222 action = 'store_true' ,
219223 default = None ,
220- help = 'Verify server certificate (default)' ,
224+ help = _ ( 'Verify server certificate (default)' ) ,
221225 )
222226 verify_group .add_argument (
223227 '--insecure' ,
224228 action = 'store_true' ,
225229 default = None ,
226- help = 'Disable server certificate verification' ,
230+ help = _ ( 'Disable server certificate verification' ) ,
227231 )
228232 parser .add_argument (
229233 '--os-default-domain' ,
@@ -232,28 +236,29 @@ def build_option_parser(self, description, version):
232236 default = utils .env (
233237 'OS_DEFAULT_DOMAIN' ,
234238 default = DEFAULT_DOMAIN ),
235- help = 'Default domain ID, default=' +
236- DEFAULT_DOMAIN +
237- ' (Env: OS_DEFAULT_DOMAIN)' )
239+ help = _ ( 'Default domain ID, default=%s. '
240+ '(Env: OS_DEFAULT_DOMAIN)' ) % DEFAULT_DOMAIN ,
241+ )
238242 parser .add_argument (
239243 '--os-interface' ,
240244 metavar = '<interface>' ,
241245 dest = 'interface' ,
242246 choices = ['admin' , 'public' , 'internal' ],
243247 default = utils .env ('OS_INTERFACE' ),
244- help = 'Select an interface type.'
245- ' Valid interface types: [admin, public, internal].'
246- ' (Env: OS_INTERFACE)' )
248+ help = _ ('Select an interface type.'
249+ ' Valid interface types: [admin, public, internal].'
250+ ' (Env: OS_INTERFACE)' ),
251+ )
247252 parser .add_argument (
248253 '--timing' ,
249254 default = False ,
250255 action = 'store_true' ,
251- help = "Print API call timing info" ,
256+ help = _ ( "Print API call timing info" ) ,
252257 )
253258 parser .add_argument (
254259 '--os-beta-command' ,
255260 action = 'store_true' ,
256- help = "Enable beta commands which are subject to change" ,
261+ help = _ ( "Enable beta commands which are subject to change" ) ,
257262 )
258263
259264 # osprofiler HMAC key argument
@@ -262,7 +267,7 @@ def build_option_parser(self, description, version):
262267 '--os-profile' ,
263268 metavar = 'hmac-key' ,
264269 dest = 'profile' ,
265- help = 'HMAC key for encrypting profiling context data' ,
270+ help = _ ( 'HMAC key for encrypting profiling context data' ) ,
266271 )
267272 # NOTE(dtroyer): This global option should have been named
268273 # --os-profile as --profile interferes with at
0 commit comments