Revised the documentation of the make_trans management command.

This commit is contained in:
依瑪貓 2021-02-03 10:05:07 +08:00
parent 500467432a
commit b4d9a250db

View File

@ -30,8 +30,13 @@ from opencc import OpenCC
class Command(BaseCommand): class Command(BaseCommand):
"""Populates the database with sample accounting data.""" """Updates the revision date, converts the Traditional Chinese
help = "Fills the database with the accounting accounts." translation into Simplified Chinese, and then calls the
compilemessages command.
"""
help = ("Updates the revision date, converts the Traditional Chinese"
" translation into Simplified Chinese, and then calls the"
" compilemessages command.")
def __init__(self): def __init__(self):
super().__init__() super().__init__()
@ -44,8 +49,9 @@ class Command(BaseCommand):
Args: Args:
parser (CommandParser): The command line argument parser. parser (CommandParser): The command line argument parser.
""" """
parser.add_argument("proj_dir", nargs="+", parser.add_argument("app_dir", nargs="+",
help="The domain, either django or djangojs") help=("One or more application directories that"
" contains their locale subdirectories"))
parser.add_argument("--domain", "-d", action="append", parser.add_argument("--domain", "-d", action="append",
choices=["django", "djangojs"], required=True, choices=["django", "djangojs"], required=True,
help="The domain, either django or djangojs") help="The domain, either django or djangojs")
@ -58,7 +64,7 @@ class Command(BaseCommand):
**options (dict[str,str]): The command line switches. **options (dict[str,str]): The command line switches.
""" """
locale_dirs = [os.path.join(settings.BASE_DIR, x, "locale") locale_dirs = [os.path.join(settings.BASE_DIR, x, "locale")
for x in options["proj_dir"]] for x in options["app_dir"]]
missing = [x for x in locale_dirs if not os.path.isdir(x)] missing = [x for x in locale_dirs if not os.path.isdir(x)]
if len(missing) > 0: if len(missing) > 0:
error = "Directories not exist: " + ", ".join(missing) error = "Directories not exist: " + ", ".join(missing)