diff --git a/doc/source/command-objects/network.rst b/doc/source/command-objects/network.rst index 6d3f505ab3..e2f5eaf0ee 100644 --- a/doc/source/command-objects/network.rst +++ b/doc/source/command-objects/network.rst @@ -59,7 +59,7 @@ Create new network .. option:: --availability-zone-hint <availability-zone> Availability Zone in which to create this network - (requires the Network Availability Zone extension, + (Network Availability Zone extension required, repeat option to set multiple availability zones) *Network version 2 only* @@ -72,8 +72,8 @@ Create new network .. option:: --external - Set this network as an external network. - Requires the "external-net" extension to be enabled. + Set this network as an external network + (external-net extension required) *Network version 2 only* @@ -92,8 +92,8 @@ Create new network .. option:: --no-default - Do not use the network as the default external network. - By default, no network is set as an external network. + Do not use the network as the default external network + (default) *Network version 2 only* @@ -197,7 +197,7 @@ Set network properties .. option:: --external Set this network as an external network. - Requires the "external-net" extension to be enabled. + (external-net extension required) .. option:: --internal @@ -205,8 +205,7 @@ Set network properties .. option:: --default - Specify if this network should be used as - the default external network + Set the network as the default external network .. option:: --no-default diff --git a/doc/source/command-objects/port.rst b/doc/source/command-objects/port.rst index cc7723eaf6..36e830822e 100644 --- a/doc/source/command-objects/port.rst +++ b/doc/source/command-objects/port.rst @@ -45,8 +45,8 @@ Create new port .. option:: --vnic-type <vnic-type> - VNIC type for this port (direct | direct-physical | macvtap | normal | baremetal). - If unspecified during port creation, default value will be 'normal'. + VNIC type for this port (direct | direct-physical | macvtap | normal | baremetal, + default: normal) .. option:: --binding-profile <binding-profile> @@ -141,7 +141,7 @@ Set port properties .. option:: --no-fixed-ip - Clear existing information of fixed-ips + Clear existing information of fixed IP addresses .. option:: --device <device-id> @@ -153,8 +153,8 @@ Set port properties .. option:: --vnic-type <vnic-type> - VNIC type for this port (direct | direct-physical | macvtap | normal | baremetal). - If unspecified during port creation, default value will be 'normal'. + VNIC type for this port (direct | direct-physical | macvtap | normal | baremetal, + default: normal) .. option:: --binding-profile <binding-profile> diff --git a/doc/source/command-objects/router.rst b/doc/source/command-objects/router.rst index dc645712ec..1503516e44 100644 --- a/doc/source/command-objects/router.rst +++ b/doc/source/command-objects/router.rst @@ -87,7 +87,7 @@ Create new router .. option:: --availability-zone-hint <availability-zone> Availability Zone in which to create this router - (requires the Router Availability Zone extension, + (Router Availability Zone extension required, repeat option to set multiple availability zones) .. _router_create-name: diff --git a/doc/source/command-objects/subnet-pool.rst b/doc/source/command-objects/subnet-pool.rst index 80a9c013bb..3b7d0e91ed 100644 --- a/doc/source/command-objects/subnet-pool.rst +++ b/doc/source/command-objects/subnet-pool.rst @@ -49,8 +49,8 @@ Create subnet pool .. option:: --address-scope <address-scope> - Set address scope associated with the subnet pool (name or ID). - Prefixes must be unique across address scopes. + Set address scope associated with the subnet pool (name or ID), + prefixes must be unique across address scopes .. _subnet_pool_create-name: .. describe:: <name> @@ -128,8 +128,8 @@ Set subnet pool properties .. option:: --address-scope <address-scope> - Set address scope associated with the subnet pool (name or ID). - Prefixes must be unique across address scopes. + Set address scope associated with the subnet pool (name or ID), + prefixes must be unique across address scopes .. option:: --no-address-scope diff --git a/doc/source/command-objects/subnet.rst b/doc/source/command-objects/subnet.rst index 50be5b0a96..35134f4699 100644 --- a/doc/source/command-objects/subnet.rst +++ b/doc/source/command-objects/subnet.rst @@ -206,7 +206,7 @@ Set subnet properties subnet show ----------- -Show subnet details +Display subnet details .. program:: subnet show .. code:: bash @@ -217,4 +217,4 @@ Show subnet details .. _subnet_show-subnet: .. describe:: <subnet> - Subnet to show (name or ID) + Subnet to display (name or ID) diff --git a/openstackclient/network/v2/floating_ip.py b/openstackclient/network/v2/floating_ip.py index b21d6e968d..21f8659910 100644 --- a/openstackclient/network/v2/floating_ip.py +++ b/openstackclient/network/v2/floating_ip.py @@ -14,6 +14,7 @@ """IP Floating action implementations""" from openstackclient.common import utils +from openstackclient.i18n import _ from openstackclient.network import common @@ -63,7 +64,7 @@ class CreateFloatingIP(common.NetworkAndComputeShowOne): parser.add_argument( 'network', metavar='<network>', - help='Network to allocate floating IP from (name or ID)', + help=_("Network to allocate floating IP from (name or ID)") ) return parser @@ -71,26 +72,26 @@ class CreateFloatingIP(common.NetworkAndComputeShowOne): parser.add_argument( '--subnet', metavar='<subnet>', - help="Subnet on which you want to create the floating IP " - "(name or ID)" + help=_("Subnet on which you want to create the floating IP " + "(name or ID)") ) parser.add_argument( '--port', metavar='<port>', - help="Port to be associated with the floating IP " - "(name or ID)" + help=_("Port to be associated with the floating IP " + "(name or ID)") ) parser.add_argument( '--floating-ip-address', metavar='<floating-ip-address>', dest='floating_ip_address', - help="Floating IP address" + help=_("Floating IP address") ) parser.add_argument( '--fixed-ip-address', metavar='<fixed-ip-address>', dest='fixed_ip_address', - help="Fixed IP address mapped to the floating IP" + help=_("Fixed IP address mapped to the floating IP") ) return parser @@ -115,7 +116,7 @@ class DeleteFloatingIP(common.NetworkAndComputeCommand): parser.add_argument( 'floating_ip', metavar="<floating-ip>", - help=("Floating IP to delete (IP address or ID)") + help=_("Floating IP to delete (IP address or ID)") ) return parser @@ -189,7 +190,7 @@ class ShowFloatingIP(common.NetworkAndComputeShowOne): parser.add_argument( 'floating_ip', metavar="<floating-ip>", - help=("Floating IP to display (IP address or ID)") + help=_("Floating IP to display (IP address or ID)") ) return parser diff --git a/openstackclient/network/v2/network.py b/openstackclient/network/v2/network.py index afac471a7d..d57a1ed6c2 100644 --- a/openstackclient/network/v2/network.py +++ b/openstackclient/network/v2/network.py @@ -16,6 +16,7 @@ from openstackclient.common import command from openstackclient.common import exceptions from openstackclient.common import utils +from openstackclient.i18n import _ from openstackclient.identity import common as identity_common from openstackclient.network import common @@ -110,19 +111,19 @@ class CreateNetwork(common.NetworkAndComputeShowOne): parser.add_argument( 'name', metavar='<name>', - help='New network name', + help=_("New network name") ) share_group = parser.add_mutually_exclusive_group() share_group.add_argument( '--share', action='store_true', default=None, - help='Share the network between projects', + help=_("Share the network between projects") ) share_group.add_argument( '--no-share', action='store_true', - help='Do not share the network between projects', + help=_("Do not share the network between projects") ) return parser @@ -132,17 +133,17 @@ class CreateNetwork(common.NetworkAndComputeShowOne): '--enable', action='store_true', default=True, - help='Enable network (default)', + help=_("Enable network (default)") ) admin_group.add_argument( '--disable', action='store_true', - help='Disable network', + help=_("Disable network") ) parser.add_argument( '--project', metavar='<project>', - help="Owner's project (name or ID)" + help=_("Owner's project (name or ID)") ) identity_common.add_project_domain_option_to_parser(parser) parser.add_argument( @@ -150,58 +151,65 @@ class CreateNetwork(common.NetworkAndComputeShowOne): action='append', dest='availability_zone_hints', metavar='<availability-zone>', - help='Availability Zone in which to create this network ' - '(requires the Network Availability Zone extension, ' - 'repeat option to set multiple availability zones)', + help=_("Availability Zone in which to create this network " + "(Network Availability Zone extension required, " + "repeat option to set multiple availability zones)") ) external_router_grp = parser.add_mutually_exclusive_group() external_router_grp.add_argument( '--external', action='store_true', - help='Set this network as an external network. ' - 'Requires the "external-net" extension to be enabled.') + help=_("Set this network as an external network " + "(external-net extension required)") + ) external_router_grp.add_argument( '--internal', action='store_true', - help='Set this network as an internal network (default)') + help=_("Set this network as an internal network (default)") + ) default_router_grp = parser.add_mutually_exclusive_group() default_router_grp.add_argument( '--default', action='store_true', - help='Specify if this network should be used as ' - 'the default external network') + help=_("Specify if this network should be used as " + "the default external network") + ) default_router_grp.add_argument( '--no-default', action='store_true', - help='Do not use the network as the default external network.' - 'By default, no network is set as an external network.') + help=_("Do not use the network as the default external network. " + "(default)") + ) parser.add_argument( '--provider-network-type', metavar='<provider-network-type>', choices=['flat', 'gre', 'local', 'vlan', 'vxlan'], - help='The physical mechanism by which the virtual network ' - 'is implemented. The supported options are: ' - 'flat, gre, local, vlan, vxlan') + help=_("The physical mechanism by which the virtual network " + "is implemented. The supported options are: " + "flat, gre, local, vlan, vxlan") + ) parser.add_argument( '--provider-physical-network', metavar='<provider-physical-network>', dest='physical_network', - help='Name of the physical network over which the virtual ' - 'network is implemented') + help=_("Name of the physical network over which the virtual " + "network is implemented") + ) parser.add_argument( '--provider-segment', metavar='<provider-segment>', dest='segmentation_id', - help='VLAN ID for VLAN networks or Tunnel ID for GRE/VXLAN ' - 'networks') + help=_("VLAN ID for VLAN networks or Tunnel ID for GRE/VXLAN " + "networks") + ) return parser def update_parser_compute(self, parser): parser.add_argument( '--subnet', metavar='<subnet>', - help="IPv4 subnet for fixed IPs (in CIDR notation)" + help=_("IPv4 subnet for fixed IPs (in CIDR notation)") ) return parser @@ -350,57 +358,60 @@ class SetNetwork(command.Command): parser.add_argument( 'network', metavar="<network>", - help=("Network to modify (name or ID)") + help=_("Network to modify (name or ID)") ) parser.add_argument( '--name', metavar='<name>', - help='Set network name', + help=_("Set network name") ) admin_group = parser.add_mutually_exclusive_group() admin_group.add_argument( '--enable', action='store_true', default=None, - help='Enable network', + help=_("Enable network") ) admin_group.add_argument( '--disable', action='store_true', - help='Disable network', + help=_("Disable network") ) share_group = parser.add_mutually_exclusive_group() share_group.add_argument( '--share', action='store_true', default=None, - help='Share the network between projects', + help=_("Share the network between projects") ) share_group.add_argument( '--no-share', action='store_true', - help='Do not share the network between projects', + help=_("Do not share the network between projects") ) external_router_grp = parser.add_mutually_exclusive_group() external_router_grp.add_argument( '--external', action='store_true', - help='Set this network as an external network. ' - 'Requires the "external-net" extension to be enabled.') + help=_("Set this network as an external network " + "(external-net extension required)") + ) external_router_grp.add_argument( '--internal', action='store_true', - help='Set this network as an internal network') + help=_("Set this network as an internal network") + ) default_router_grp = parser.add_mutually_exclusive_group() default_router_grp.add_argument( '--default', action='store_true', - help='Specify if this network should be used as ' - 'the default external network') + help=_("Set the network as the default external network") + ) default_router_grp.add_argument( '--no-default', action='store_true', - help='Do not use the network as the default external network.') + help=_("Do not use the network as the default external network") + ) return parser def take_action(self, parsed_args): @@ -422,7 +433,7 @@ class ShowNetwork(common.NetworkAndComputeShowOne): parser.add_argument( 'network', metavar="<network>", - help=("Network to display (name or ID)") + help=_("Network to display (name or ID)") ) return parser diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py index c54cb257a1..fbfce4d38f 100644 --- a/openstackclient/network/v2/port.py +++ b/openstackclient/network/v2/port.py @@ -158,7 +158,7 @@ def _add_updatable_args(parser): device_group.add_argument( '--device', metavar='<device-id>', - help='Port device ID', + help=_("Port device ID") ) device_group.add_argument( '--device-id', @@ -168,22 +168,23 @@ def _add_updatable_args(parser): parser.add_argument( '--device-owner', metavar='<device-owner>', - help='Device owner of this port') + help=_("Device owner of this port") + ) parser.add_argument( '--vnic-type', metavar='<vnic-type>', choices=['direct', 'direct-physical', 'macvtap', 'normal', 'baremetal'], - help="VNIC type for this port (direct | direct-physical |" - " macvtap | normal | baremetal). If unspecified during" - " port creation, default value will be 'normal'.") + help=_("VNIC type for this port (direct | direct-physical | " + "macvtap | normal | baremetal, default: normal)") + ) # NOTE(dtroyer): --host-id is deprecated in Mar 2016. Do not # remove before 3.x release or Mar 2017. host_group = parser.add_mutually_exclusive_group() host_group.add_argument( '--host', metavar='<host-id>', - help='Allocate port on host <host-id> (ID only)', + help=_("Allocate port on host <host-id> (ID only)") ) host_group.add_argument( '--host-id', @@ -202,47 +203,53 @@ class CreatePort(command.ShowOne): '--network', metavar='<network>', required=True, - help='Network this port belongs to (name or ID)') + help=_("Network this port belongs to (name or ID)") + ) _add_updatable_args(parser) parser.add_argument( '--fixed-ip', metavar='subnet=<subnet>,ip-address=<ip-address>', action=parseractions.MultiKeyValueAction, optional_keys=['subnet', 'ip-address'], - help='Desired IP and/or subnet (name or ID) for this port: ' - 'subnet=<subnet>,ip-address=<ip-address> ' - '(repeat option to set multiple fixed IP addresses)') + help=_("Desired IP and/or subnet (name or ID) for this port: " + "subnet=<subnet>,ip-address=<ip-address> " + "(repeat option to set multiple fixed IP addresses)") + ) parser.add_argument( '--binding-profile', metavar='<binding-profile>', action=parseractions.KeyValueAction, - help='Custom data to be passed as binding:profile: <key>=<value> ' - '(repeat option to set multiple binding:profile data)') + help=_("Custom data to be passed as binding:profile: " + "<key>=<value> " + "(repeat option to set multiple binding:profile data)") + ) admin_group = parser.add_mutually_exclusive_group() admin_group.add_argument( '--enable', action='store_true', default=True, - help='Enable port (default)', + help=_("Enable port (default)") ) admin_group.add_argument( '--disable', action='store_true', - help='Disable port', + help=_("Disable port") ) parser.add_argument( '--mac-address', metavar='<mac-address>', - help='MAC address of this port') + help=_("MAC address of this port") + ) parser.add_argument( '--project', metavar='<project>', - help="Owner's project (name or ID)") + help=_("Owner's project (name or ID)") + ) + identity_common.add_project_domain_option_to_parser(parser) parser.add_argument( 'name', metavar='<name>', help='Name of this port') - identity_common.add_project_domain_option_to_parser(parser) # TODO(singhj): Add support for extended options: # qos,security groups,dhcp, address pairs return parser @@ -270,7 +277,7 @@ class DeletePort(command.Command): 'port', metavar="<port>", nargs="+", - help=("Port(s) to delete (name or ID)") + help=_("Port(s) to delete (name or ID)") ) return parser @@ -291,7 +298,7 @@ class ListPort(command.Lister): '--router', metavar='<router>', dest='router', - help='List only ports attached to this router (name or ID)', + help=_("List only ports attached to this router (name or ID)") ) return parser @@ -337,21 +344,17 @@ class SetPort(command.Command): '--enable', action='store_true', default=None, - help='Enable port', + help=_("Enable port") ) admin_group.add_argument( '--disable', action='store_true', - help='Disable port', + help=_("Disable port") ) parser.add_argument( '--name', metavar="<name>", - help=('Set port name')) - parser.add_argument( - 'port', - metavar="<port>", - help=("Port to modify (name or ID)") + help=_("Set port name") ) fixed_ip = parser.add_mutually_exclusive_group() fixed_ip.add_argument( @@ -359,24 +362,34 @@ class SetPort(command.Command): metavar='subnet=<subnet>,ip-address=<ip-address>', action=parseractions.MultiKeyValueAction, optional_keys=['subnet', 'ip-address'], - help='Desired IP and/or subnet (name or ID) for this port: ' - 'subnet=<subnet>,ip-address=<ip-address> ' - '(repeat option to set multiple fixed IP addresses)') + help=_("Desired IP and/or subnet (name or ID) for this port: " + "subnet=<subnet>,ip-address=<ip-address> " + "(repeat option to set multiple fixed IP addresses)") + ) fixed_ip.add_argument( '--no-fixed-ip', action='store_true', - help='Clear existing information of fixed-ips') + help=_("Clear existing information of fixed IP addresses") + ) binding_profile = parser.add_mutually_exclusive_group() binding_profile.add_argument( '--binding-profile', metavar='<binding-profile>', action=parseractions.KeyValueAction, - help='Custom data to be passed as binding:profile: <key>=<value> ' - '(repeat option to set multiple binding:profile data)') + help=_("Custom data to be passed as binding:profile: " + "<key>=<value> " + "(repeat option to set multiple binding:profile data)") + ) binding_profile.add_argument( '--no-binding-profile', action='store_true', - help='Clear existing information of binding:profile') + help=_("Clear existing information of binding:profile") + ) + parser.add_argument( + 'port', + metavar="<port>", + help=_("Port to modify (name or ID)") + ) return parser def take_action(self, parsed_args): @@ -413,7 +426,7 @@ class ShowPort(command.ShowOne): parser.add_argument( 'port', metavar="<port>", - help="Port to display (name or ID)" + help=_("Port to display (name or ID)") ) return parser diff --git a/openstackclient/network/v2/router.py b/openstackclient/network/v2/router.py index 2ededae87e..56630a2303 100644 --- a/openstackclient/network/v2/router.py +++ b/openstackclient/network/v2/router.py @@ -19,6 +19,7 @@ from openstackclient.common import command from openstackclient.common import exceptions from openstackclient.common import parseractions from openstackclient.common import utils +from openstackclient.i18n import _ from openstackclient.identity import common as identity_common @@ -95,12 +96,12 @@ class AddPortToRouter(command.Command): parser.add_argument( 'router', metavar='<router>', - help="Router to which port will be added (name or ID)", + help=_("Router to which port will be added (name or ID)") ) parser.add_argument( 'port', metavar='<port>', - help="Port to be added (name or ID)", + help=_("Port to be added (name or ID)") ) return parser @@ -119,12 +120,12 @@ class AddSubnetToRouter(command.Command): parser.add_argument( 'router', metavar='<router>', - help="Router to which subnet will be added (name or ID)", + help=_("Router to which subnet will be added (name or ID)") ) parser.add_argument( 'subnet', metavar='<subnet>', - help="Subnet to be added (name or ID)", + help=_("Subnet to be added (name or ID)") ) return parser @@ -146,43 +147,43 @@ class CreateRouter(command.ShowOne): parser.add_argument( 'name', metavar='<name>', - help="New router name", + help=_("New router name") ) admin_group = parser.add_mutually_exclusive_group() admin_group.add_argument( '--enable', action='store_true', default=True, - help="Enable router (default)", + help=_("Enable router (default)") ) admin_group.add_argument( '--disable', action='store_true', - help="Disable router", + help=_("Disable router") ) parser.add_argument( '--distributed', dest='distributed', action='store_true', default=False, - help="Create a distributed router", + help=_("Create a distributed router") ) parser.add_argument( '--project', metavar='<project>', - help="Owner's project (name or ID)", + help=_("Owner's project (name or ID)") ) + identity_common.add_project_domain_option_to_parser(parser) parser.add_argument( '--availability-zone-hint', metavar='<availability-zone>', action='append', dest='availability_zone_hints', - help='Availability Zone in which to create this router ' - '(requires the Router Availability Zone extension, ' - 'repeat option to set multiple availability zones)', + help=_("Availability Zone in which to create this router " + "(Router Availability Zone extension required, " + "repeat option to set multiple availability zones)") ) - identity_common.add_project_domain_option_to_parser(parser) return parser def take_action(self, parsed_args): @@ -206,7 +207,7 @@ class DeleteRouter(command.Command): 'router', metavar="<router>", nargs="+", - help=("Router(s) to delete (name or ID)") + help=_("Router(s) to delete (name or ID)") ) return parser @@ -226,7 +227,7 @@ class ListRouter(command.Lister): '--long', action='store_true', default=False, - help='List additional fields in output', + help=_("List additional fields in output") ) return parser @@ -279,12 +280,12 @@ class RemovePortFromRouter(command.Command): parser.add_argument( 'router', metavar='<router>', - help="Router from which port will be removed (name or ID)", + help=_("Router from which port will be removed (name or ID)") ) parser.add_argument( 'port', metavar='<port>', - help="Port to be removed (name or ID).", + help=_("Port to be removed (name or ID)") ) return parser @@ -303,12 +304,12 @@ class RemoveSubnetFromRouter(command.Command): parser.add_argument( 'router', metavar='<router>', - help="Router from which the subnet will be removed (name or ID)", + help=_("Router from which the subnet will be removed (name or ID)") ) parser.add_argument( 'subnet', metavar='<subnet>', - help="Subnet to be removed (name or ID)", + help=_("Subnet to be removed (name or ID)") ) return parser @@ -330,35 +331,35 @@ class SetRouter(command.Command): parser.add_argument( 'router', metavar="<router>", - help=("Router to modify (name or ID)") + help=_("Router to modify (name or ID)") ) parser.add_argument( '--name', metavar='<name>', - help='Set router name', + help=_("Set router name") ) admin_group = parser.add_mutually_exclusive_group() admin_group.add_argument( '--enable', action='store_true', default=None, - help='Enable router', + help=_("Enable router") ) admin_group.add_argument( '--disable', action='store_true', - help='Disable router', + help=_("Disable router") ) distribute_group = parser.add_mutually_exclusive_group() distribute_group.add_argument( '--distributed', action='store_true', - help="Set router to distributed mode (disabled router only)", + help=_("Set router to distributed mode (disabled router only)") ) distribute_group.add_argument( '--centralized', action='store_true', - help="Set router to centralized mode (disabled router only)", + help=_("Set router to centralized mode (disabled router only)") ) routes_group = parser.add_mutually_exclusive_group() routes_group.add_argument( @@ -368,15 +369,15 @@ class SetRouter(command.Command): dest='routes', default=None, required_keys=['destination', 'gateway'], - help="Routes associated with the router " - "destination: destination subnet (in CIDR notation) " - "gateway: nexthop IP address " - "(repeat option to set multiple routes)", + help=_("Routes associated with the router " + "destination: destination subnet (in CIDR notation) " + "gateway: nexthop IP address " + "(repeat option to set multiple routes)") ) routes_group.add_argument( '--clear-routes', action='store_true', - help="Clear routes associated with the router", + help=_("Clear routes associated with the router") ) # TODO(tangchen): Support setting 'ha' property in 'router set' @@ -408,7 +409,7 @@ class ShowRouter(command.ShowOne): parser.add_argument( 'router', metavar="<router>", - help="Router to display (name or ID)" + help=_("Router to display (name or ID)") ) return parser diff --git a/openstackclient/network/v2/security_group.py b/openstackclient/network/v2/security_group.py index 92498144a5..1ef2754e43 100644 --- a/openstackclient/network/v2/security_group.py +++ b/openstackclient/network/v2/security_group.py @@ -17,6 +17,7 @@ import argparse import six from openstackclient.common import utils +from openstackclient.i18n import _ from openstackclient.identity import common as identity_common from openstackclient.network import common from openstackclient.network import utils as network_utils @@ -99,12 +100,12 @@ class CreateSecurityGroup(common.NetworkAndComputeShowOne): parser.add_argument( "name", metavar="<name>", - help="New security group name", + help=_("New security group name") ) parser.add_argument( "--description", metavar="<description>", - help="Security group description", + help=_("Security group description") ) return parser @@ -112,7 +113,7 @@ class CreateSecurityGroup(common.NetworkAndComputeShowOne): parser.add_argument( '--project', metavar='<project>', - help="Owner's project (name or ID)" + help=_("Owner's project (name or ID)") ) identity_common.add_project_domain_option_to_parser(parser) return parser @@ -169,7 +170,7 @@ class DeleteSecurityGroup(common.NetworkAndComputeCommand): parser.add_argument( 'group', metavar='<group>', - help='Security group to delete (name or ID)', + help=_("Security group to delete (name or ID)") ) return parser @@ -204,7 +205,7 @@ class ListSecurityGroup(common.NetworkAndComputeLister): '--all-projects', action='store_true', default=False, - help='Display information from all projects (admin only)', + help=_("Display information from all projects (admin only)") ) return parser @@ -240,17 +241,17 @@ class SetSecurityGroup(common.NetworkAndComputeCommand): parser.add_argument( 'group', metavar='<group>', - help='Security group to modify (name or ID)', + help=_("Security group to modify (name or ID)") ) parser.add_argument( '--name', metavar='<new-name>', - help='New security group name', + help=_("New security group name") ) parser.add_argument( "--description", metavar="<description>", - help="New security group description", + help=_("New security group description") ) return parser @@ -295,7 +296,7 @@ class ShowSecurityGroup(common.NetworkAndComputeShowOne): parser.add_argument( 'group', metavar='<group>', - help='Security group to display (name or ID)', + help=_("Security group to display (name or ID)") ) return parser diff --git a/openstackclient/network/v2/security_group_rule.py b/openstackclient/network/v2/security_group_rule.py index 509b197442..67472de05d 100644 --- a/openstackclient/network/v2/security_group_rule.py +++ b/openstackclient/network/v2/security_group_rule.py @@ -23,6 +23,7 @@ except ImportError: from openstackclient.common import exceptions from openstackclient.common import parseractions from openstackclient.common import utils +from openstackclient.i18n import _ from openstackclient.identity import common as identity_common from openstackclient.network import common from openstackclient.network import utils as network_utils @@ -78,27 +79,27 @@ class CreateSecurityGroupRule(common.NetworkAndComputeShowOne): default="tcp", choices=['icmp', 'tcp', 'udp'], type=_convert_to_lowercase, - help="IP protocol (icmp, tcp, udp; default: tcp)", + help=_("IP protocol (icmp, tcp, udp; default: tcp)") ) source_group = parser.add_mutually_exclusive_group() source_group.add_argument( "--src-ip", metavar="<ip-address>", - help="Source IP address block (may use CIDR notation; " - "default for IPv4 rule: 0.0.0.0/0)", + help=_("Source IP address block (may use CIDR notation; " + "default for IPv4 rule: 0.0.0.0/0)") ) source_group.add_argument( "--src-group", metavar="<group>", - help="Source security group (name or ID)", + help=_("Source security group (name or ID)") ) parser.add_argument( "--dst-port", metavar="<port-range>", default=(0, 0), action=parseractions.RangeAction, - help="Destination port, may be a single port or port range: " - "137:139 (only required for IP protocols tcp and udp)", + help=_("Destination port, may be a single port or port range: " + "137:139 (only required for IP protocols tcp and udp)") ) return parser @@ -107,24 +108,23 @@ class CreateSecurityGroupRule(common.NetworkAndComputeShowOne): direction_group.add_argument( '--ingress', action='store_true', - help='Rule applies to incoming network traffic (default)', + help=_("Rule applies to incoming network traffic (default)") ) direction_group.add_argument( '--egress', action='store_true', - help='Rule applies to outgoing network traffic', + help=_("Rule applies to outgoing network traffic") ) parser.add_argument( '--ethertype', metavar='<ethertype>', choices=['IPv4', 'IPv6'], - help='Ethertype of network traffic ' - '(IPv4, IPv6; default: IPv4)', + help=_("Ethertype of network traffic (IPv4, IPv6; default: IPv4)") ) parser.add_argument( '--project', metavar='<project>', - help="Owner's project (name or ID)" + help=_("Owner's project (name or ID)") ) identity_common.add_project_domain_option_to_parser(parser) return parser @@ -218,7 +218,7 @@ class DeleteSecurityGroupRule(common.NetworkAndComputeCommand): parser.add_argument( 'rule', metavar='<rule>', - help='Security group rule to delete (ID only)', + help=_("Security group rule to delete (ID only)") ) return parser @@ -238,7 +238,7 @@ class ListSecurityGroupRule(common.NetworkAndComputeLister): 'group', metavar='<group>', nargs='?', - help='List all rules in this security group (name or ID)', + help=_("List all rules in this security group (name or ID)") ) return parser @@ -333,7 +333,7 @@ class ShowSecurityGroupRule(common.NetworkAndComputeShowOne): parser.add_argument( 'rule', metavar="<rule>", - help="Security group rule to display (ID only)" + help=_("Security group rule to display (ID only)") ) return parser diff --git a/openstackclient/network/v2/subnet.py b/openstackclient/network/v2/subnet.py index 3d539fea4d..715e662026 100644 --- a/openstackclient/network/v2/subnet.py +++ b/openstackclient/network/v2/subnet.py @@ -20,6 +20,7 @@ from openstackclient.common import command from openstackclient.common import exceptions from openstackclient.common import parseractions from openstackclient.common import utils +from openstackclient.i18n import _ from openstackclient.identity import common as identity_common @@ -50,17 +51,17 @@ def _get_common_parse_arguments(parser): dest='allocation_pools', action=parseractions.MultiKeyValueAction, required_keys=['start', 'end'], - help='Allocation pool IP addresses for this subnet ' - 'e.g.: start=192.168.199.2,end=192.168.199.254 ' - '(repeat option to add multiple IP addresses)', + help=_("Allocation pool IP addresses for this subnet " + "e.g.: start=192.168.199.2,end=192.168.199.254 " + "(repeat option to add multiple IP addresses)") ) parser.add_argument( '--dns-nameserver', metavar='<dns-nameserver>', action='append', dest='dns_nameservers', - help='DNS server for this subnet ' - '(repeat option to set multiple DNS servers)', + help=_("DNS server for this subnet " + "(repeat option to set multiple DNS servers)") ) parser.add_argument( '--host-route', @@ -68,11 +69,11 @@ def _get_common_parse_arguments(parser): dest='host_routes', action=parseractions.MultiKeyValueAction, required_keys=['destination', 'gateway'], - help='Additional route for this subnet ' - 'e.g.: destination=10.10.0.0/16,gateway=192.168.71.254 ' - 'destination: destination subnet (in CIDR notation) ' - 'gateway: nexthop IP address ' - '(repeat option to add multiple routes)', + help=_("Additional route for this subnet " + "e.g.: destination=10.10.0.0/16,gateway=192.168.71.254 " + "destination: destination subnet (in CIDR notation) " + "gateway: nexthop IP address " + "(repeat option to add multiple routes)") ) @@ -174,87 +175,87 @@ class CreateSubnet(command.ShowOne): parser = super(CreateSubnet, self).get_parser(prog_name) parser.add_argument( 'name', - help='New subnet name', + help=_("New subnet name") ) parser.add_argument( '--project', metavar='<project>', - help="Owner's project (name or ID)", + help=_("Owner's project (name or ID)") ) identity_common.add_project_domain_option_to_parser(parser) subnet_pool_group = parser.add_mutually_exclusive_group() subnet_pool_group.add_argument( '--subnet-pool', metavar='<subnet-pool>', - help='Subnet pool from which this subnet will obtain a CIDR ' - '(Name or ID)', + help=_("Subnet pool from which this subnet will obtain a CIDR " + "(Name or ID)") ) subnet_pool_group.add_argument( '--use-default-subnet-pool', action='store_true', - help='Use default subnet pool for --ip-version', + help=_("Use default subnet pool for --ip-version") ) parser.add_argument( '--prefix-length', metavar='<prefix-length>', - help='Prefix length for subnet allocation from subnet pool', + help=_("Prefix length for subnet allocation from subnet pool") ) parser.add_argument( '--subnet-range', metavar='<subnet-range>', - help='Subnet range in CIDR notation ' - '(required if --subnet-pool is not specified, ' - 'optional otherwise)', + help=_("Subnet range in CIDR notation " + "(required if --subnet-pool is not specified, " + "optional otherwise)") ) dhcp_enable_group = parser.add_mutually_exclusive_group() dhcp_enable_group.add_argument( '--dhcp', action='store_true', default=True, - help='Enable DHCP (default)', + help=_("Enable DHCP (default)") ) dhcp_enable_group.add_argument( '--no-dhcp', action='store_true', - help='Disable DHCP', + help=_("Disable DHCP") ) parser.add_argument( '--gateway', metavar='<gateway>', default='auto', - help="Specify a gateway for the subnet. The three options are: " - "<ip-address>: Specific IP address to use as the gateway, " - "'auto': Gateway address should automatically be chosen from " - "within the subnet itself, 'none': This subnet will not use " - "a gateway, e.g.: --gateway 192.168.9.1, --gateway auto, " - "--gateway none (default is 'auto')", + help=_("Specify a gateway for the subnet. The three options are: " + "<ip-address>: Specific IP address to use as the gateway, " + "'auto': Gateway address should automatically be chosen " + "from within the subnet itself, 'none': This subnet will " + "not use a gateway, e.g.: --gateway 192.168.9.1, " + "--gateway auto, --gateway none (default is 'auto')") ) parser.add_argument( '--ip-version', type=int, default=4, choices=[4, 6], - help='IP version (default is 4). Note that when subnet pool is ' - 'specified, IP version is determined from the subnet pool ' - 'and this option is ignored.', + help=_("IP version (default is 4). Note that when subnet pool is " + "specified, IP version is determined from the subnet pool " + "and this option is ignored") ) parser.add_argument( '--ipv6-ra-mode', choices=['dhcpv6-stateful', 'dhcpv6-stateless', 'slaac'], - help='IPv6 RA (Router Advertisement) mode, ' - 'valid modes: [dhcpv6-stateful, dhcpv6-stateless, slaac]', + help=_("IPv6 RA (Router Advertisement) mode, " + "valid modes: [dhcpv6-stateful, dhcpv6-stateless, slaac]") ) parser.add_argument( '--ipv6-address-mode', choices=['dhcpv6-stateful', 'dhcpv6-stateless', 'slaac'], - help='IPv6 address mode, ' - 'valid modes: [dhcpv6-stateful, dhcpv6-stateless, slaac]', + help=_("IPv6 address mode, " + "valid modes: [dhcpv6-stateful, dhcpv6-stateless, slaac]") ) parser.add_argument( '--network', required=True, metavar='<network>', - help='Network this subnet belongs to (name or ID)', + help=_("Network this subnet belongs to (name or ID)") ) _get_common_parse_arguments(parser) return parser @@ -276,7 +277,7 @@ class DeleteSubnet(command.Command): parser.add_argument( 'subnet', metavar="<subnet>", - help="Subnet to delete (name or ID)", + help=_("Subnet to delete (name or ID)") ) return parser @@ -295,7 +296,7 @@ class ListSubnet(command.Lister): '--long', action='store_true', default=False, - help='List additional fields in output', + help=_("List additional fields in output") ) return parser @@ -327,32 +328,32 @@ class SetSubnet(command.Command): parser.add_argument( 'subnet', metavar="<subnet>", - help=("Subnet to modify (name or ID)") + help=_("Subnet to modify (name or ID)") ) parser.add_argument( '--name', metavar='<name>', - help='Updated name of the subnet', + help=_("Updated name of the subnet") ) dhcp_enable_group = parser.add_mutually_exclusive_group() dhcp_enable_group.add_argument( '--dhcp', action='store_true', default=None, - help='Enable DHCP', + help=_("Enable DHCP") ) dhcp_enable_group.add_argument( '--no-dhcp', action='store_true', - help='Disable DHCP', + help=_("Disable DHCP") ) parser.add_argument( '--gateway', metavar='<gateway>', - help="Specify a gateway for the subnet. The options are: " - "<ip-address>: Specific IP address to use as the gateway, " - "'none': This subnet will not use a gateway, " - "e.g.: --gateway 192.168.9.1, --gateway none" + help=_("Specify a gateway for the subnet. The options are: " + "<ip-address>: Specific IP address to use as the gateway, " + "'none': This subnet will not use a gateway, " + "e.g.: --gateway 192.168.9.1, --gateway none") ) _get_common_parse_arguments(parser) return parser @@ -376,14 +377,14 @@ class SetSubnet(command.Command): class ShowSubnet(command.ShowOne): - """Show subnet details""" + """Display subnet details""" def get_parser(self, prog_name): parser = super(ShowSubnet, self).get_parser(prog_name) parser.add_argument( 'subnet', metavar="<subnet>", - help="Subnet to show (name or ID)", + help=_("Subnet to display (name or ID)") ) return parser diff --git a/openstackclient/network/v2/subnet_pool.py b/openstackclient/network/v2/subnet_pool.py index 0837f81b51..482b5ecf51 100644 --- a/openstackclient/network/v2/subnet_pool.py +++ b/openstackclient/network/v2/subnet_pool.py @@ -17,6 +17,7 @@ from openstackclient.common import command from openstackclient.common import exceptions from openstackclient.common import parseractions from openstackclient.common import utils +from openstackclient.i18n import _ from openstackclient.identity import common as identity_common @@ -73,26 +74,26 @@ def _add_prefix_options(parser): metavar='<pool-prefix>', dest='prefixes', action='append', - help='Set subnet pool prefixes (in CIDR notation) ' - '(repeat option to set multiple prefixes)', + help=_("Set subnet pool prefixes (in CIDR notation) " + "(repeat option to set multiple prefixes)") ) parser.add_argument( '--default-prefix-length', metavar='<default-prefix-length>', action=parseractions.NonNegativeAction, - help='Set subnet pool default prefix length', + help=_("Set subnet pool default prefix length") ) parser.add_argument( '--min-prefix-length', metavar='<min-prefix-length>', action=parseractions.NonNegativeAction, - help='Set subnet pool minimum prefix length', + help=_("Set subnet pool minimum prefix length") ) parser.add_argument( '--max-prefix-length', metavar='<max-prefix-length>', action=parseractions.NonNegativeAction, - help='Set subnet pool maximum prefix length', + help=_("Set subnet pool maximum prefix length") ) @@ -104,21 +105,21 @@ class CreateSubnetPool(command.ShowOne): parser.add_argument( 'name', metavar='<name>', - help='Name of the new subnet pool' + help=_("Name of the new subnet pool") ) _add_prefix_options(parser) parser.add_argument( '--project', metavar='<project>', - help="Owner's project (name or ID)", + help=_("Owner's project (name or ID)") ) identity_common.add_project_domain_option_to_parser(parser) parser.add_argument( '--address-scope', metavar='<address-scope>', - help="Set address scope associated with the subnet pool " - "(name or ID). Prefixes must be unique across address " - "scopes.", + help=_("Set address scope associated with the subnet pool " + "(name or ID), prefixes must be unique across address " + "scopes") ) return parser @@ -142,7 +143,7 @@ class DeleteSubnetPool(command.Command): parser.add_argument( 'subnet_pool', metavar='<subnet-pool>', - help='Subnet pool to delete (name or ID)' + help=_("Subnet pool to delete (name or ID)") ) return parser @@ -161,7 +162,7 @@ class ListSubnetPool(command.Lister): '--long', action='store_true', default=False, - help='List additional fields in output', + help=_("List additional fields in output") ) return parser @@ -210,26 +211,26 @@ class SetSubnetPool(command.Command): parser.add_argument( 'subnet_pool', metavar='<subnet-pool>', - help='Subnet pool to modify (name or ID)' + help=_("Subnet pool to modify (name or ID)") ) parser.add_argument( '--name', metavar='<name>', - help='Set subnet pool name', + help=_("Set subnet pool name") ) _add_prefix_options(parser) address_scope_group = parser.add_mutually_exclusive_group() address_scope_group.add_argument( '--address-scope', metavar='<address-scope>', - help="Set address scope associated with the subnet pool " - "(name or ID). Prefixes must be unique across address " - "scopes.", + help=_("Set address scope associated with the subnet pool " + "(name or ID), prefixes must be unique across address " + "scopes") ) address_scope_group.add_argument( '--no-address-scope', action='store_true', - help="Remove address scope associated with the subnet pool", + help=_("Remove address scope associated with the subnet pool") ) return parser @@ -258,7 +259,7 @@ class ShowSubnetPool(command.ShowOne): parser.add_argument( 'subnet_pool', metavar='<subnet-pool>', - help='Subnet pool to display (name or ID)' + help=_("Subnet pool to display (name or ID)") ) return parser