extract_messages, update_catalog: Simplify help message
Previously the help message of update_catalog shows all available languages in the command example. It is difficult to understand what an exact command line is expected. This commit uses metavar to simplify the brief command line and shows available languages in the help text. Similar change is made to 'domain' argument of update_catalog and of extract_messages. Also the default values are added in the help message. Change-Id: I63efea7e368eb1dfaf203ca4c515eb57173b571e
This commit is contained in:
parent
c3f6ee141b
commit
f3e9ef5851
|
@ -18,6 +18,9 @@ from subprocess import call
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
|
DOMAINS = ['django', 'djangojs']
|
||||||
|
MODULES = ['openstack_dashboard', 'horizon']
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = ('Extract strings that have been marked for translation into .POT '
|
help = ('Extract strings that have been marked for translation into .POT '
|
||||||
|
@ -25,12 +28,15 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
def add_arguments(self, parser):
|
def add_arguments(self, parser):
|
||||||
parser.add_argument('-m', '--module', type=str, nargs='+',
|
parser.add_argument('-m', '--module', type=str, nargs='+',
|
||||||
default=['openstack_dashboard', 'horizon'],
|
default=MODULES,
|
||||||
help=("The target python module(s) to extract "
|
help=("The target python module(s) to extract "
|
||||||
"strings from"))
|
"strings from. "
|
||||||
parser.add_argument('-d', '--domain', choices=['django', 'djangojs'],
|
"Default: %s" % MODULES))
|
||||||
nargs='+', default=['django', 'djangojs'],
|
parser.add_argument('-d', '--domain', choices=DOMAINS,
|
||||||
help="Domain(s) of the .pot file")
|
nargs='+', default=DOMAINS,
|
||||||
|
metavar='DOMAIN',
|
||||||
|
help=("Domain(s) of the .pot file. "
|
||||||
|
"Default: %s" % DOMAINS))
|
||||||
parser.add_argument('--check-only', action='store_true',
|
parser.add_argument('--check-only', action='store_true',
|
||||||
help=("Checks that extraction works correctly, "
|
help=("Checks that extraction works correctly, "
|
||||||
"then deletes the .pot file to avoid "
|
"then deletes the .pot file to avoid "
|
||||||
|
|
|
@ -28,6 +28,8 @@ LANGUAGE_CODES = [language[0] for language in settings.LANGUAGES
|
||||||
if language[0] != 'en']
|
if language[0] != 'en']
|
||||||
POTFILE = "{module}/locale/{domain}.pot"
|
POTFILE = "{module}/locale/{domain}.pot"
|
||||||
POFILE = "{module}/locale/{locale}/LC_MESSAGES/{domain}.po"
|
POFILE = "{module}/locale/{locale}/LC_MESSAGES/{domain}.po"
|
||||||
|
DOMAINS = ['django', 'djangojs']
|
||||||
|
MODULES = ['openstack_dashboard', 'horizon']
|
||||||
|
|
||||||
|
|
||||||
def translate(segment):
|
def translate(segment):
|
||||||
|
@ -61,14 +63,20 @@ class Command(BaseCommand):
|
||||||
def add_arguments(self, parser):
|
def add_arguments(self, parser):
|
||||||
parser.add_argument('-l', '--language', choices=LANGUAGE_CODES,
|
parser.add_argument('-l', '--language', choices=LANGUAGE_CODES,
|
||||||
default=LANGUAGE_CODES, nargs='+',
|
default=LANGUAGE_CODES, nargs='+',
|
||||||
help=("The language code(s) to pseudo translate"))
|
metavar='LANG',
|
||||||
|
help=("The language code(s) to pseudo translate. "
|
||||||
|
"Available languages are: %s"
|
||||||
|
% ', '.join(sorted(LANGUAGE_CODES))))
|
||||||
parser.add_argument('-m', '--module', type=str, nargs='+',
|
parser.add_argument('-m', '--module', type=str, nargs='+',
|
||||||
default=['openstack_dashboard', 'horizon'],
|
default=MODULES,
|
||||||
help=("The target python module(s) to extract "
|
help=("The target python module(s) to extract "
|
||||||
"strings from"))
|
"strings from. "
|
||||||
parser.add_argument('-d', '--domain', choices=['django', 'djangojs'],
|
"Default: %s" % MODULES))
|
||||||
nargs='+', default=['django', 'djangojs'],
|
parser.add_argument('-d', '--domain', choices=DOMAINS,
|
||||||
help="Domain(s) of the .POT file")
|
nargs='+', default=DOMAINS,
|
||||||
|
metavar='DOMAIN',
|
||||||
|
help=("Domain(s) of the .POT file. "
|
||||||
|
"Default: %s" % DOMAINS))
|
||||||
parser.add_argument('--pseudo', action='store_true',
|
parser.add_argument('--pseudo', action='store_true',
|
||||||
help=("Creates a pseudo translation for the "
|
help=("Creates a pseudo translation for the "
|
||||||
"specified locale, to check for "
|
"specified locale, to check for "
|
||||||
|
|
Loading…
Reference in New Issue