mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
refactor: update output directory handling in Crowdin translation script
- Removed the default output directory constant and updated the logic to set the output directory based on the provided argument or default to a "translated" subdirectory within the bundle directory. - Improved help text for the output directory argument to clarify its default behavior.
This commit is contained in:
parent
7ec9d64b5b
commit
698a562156
1 changed files with 6 additions and 3 deletions
|
|
@ -36,7 +36,6 @@ NS = {"x": XLIFF_NS}
|
|||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
WORK_DIR = REPO_ROOT / ".crowdin-translate"
|
||||
BUNDLES_DIR = WORK_DIR / "bundles"
|
||||
DEFAULT_OUTPUT_DIR = WORK_DIR / "translated"
|
||||
ERRORS_DIR = WORK_DIR / "errors"
|
||||
DOMAIN_PROMPT_CACHE_DIR = WORK_DIR / "domain-prompt-cache"
|
||||
|
||||
|
|
@ -876,7 +875,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|||
p.add_argument("--skip-upload", action="store_true",
|
||||
help="Skip uploading translations to Crowdin")
|
||||
p.add_argument("--output-dir", type=Path, default=None,
|
||||
help=f"Output directory (default: {DEFAULT_OUTPUT_DIR})")
|
||||
help="Output directory (default: <bundle-dir>/translated/)")
|
||||
p.add_argument("--include-docs", action="store_true",
|
||||
help="Include /docs/ files in translation (skipped by default)")
|
||||
p.add_argument("-v", "--verbose", action="store_true",
|
||||
|
|
@ -927,8 +926,12 @@ def main() -> None:
|
|||
else:
|
||||
bundle_dir = download_bundle(args.bundle_id)
|
||||
|
||||
output_dir = args.output_dir or DEFAULT_OUTPUT_DIR
|
||||
if args.output_dir:
|
||||
output_dir = args.output_dir
|
||||
else:
|
||||
output_dir = bundle_dir / "translated"
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
log.info("Output directory: %s", output_dir)
|
||||
|
||||
exclude_paths: list[str] | None = None if args.include_docs else ["/docs/"]
|
||||
if exclude_paths:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue