Files
ytdlp-tui/main.py
T
2026-09-19 14:18:15 +02:00

46 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""Entry point for the yt-dlp download manager TUI.
Sets up the bundled i18n library (see ``lib/i18n``) with the application's
own translation data (in ``i18n/<lang>/strings.json``) before starting the
Textual application.
"""
from __future__ import annotations
import sys
from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parent
# The i18n library package lives in lib/, kept separate from the i18n/
# *data* directory (project_root/i18n/<lang>/strings.json) that the library
# itself expects to find at the project root.
sys.path.insert(0, str(PROJECT_ROOT / "lib"))
from i18n import I18n # noqa: E402 (import must follow sys.path setup)
DEFAULT_LANGUAGE = "en"
AVAILABLE_LANGUAGES = {
"en": "English",
"de": "Deutsch",
}
def main() -> None:
# First construction configures the process-wide singleton; every other
# `I18n()` call elsewhere in the app returns this same instance.
I18n(
default_language=DEFAULT_LANGUAGE,
available_languages=AVAILABLE_LANGUAGES,
project_root=PROJECT_ROOT,
)
from app.tui_app import DownloadManagerApp
DownloadManagerApp().run()
if __name__ == "__main__":
main()