youtube-legend-cli 0.4.0

Non-interactive Rust CLI that downloads YouTube subtitles through third-party providers, using a native Unix stdin/stdout interface.
//! English catalogue. This is the reference wording every other locale
//! translates from, and the fallback when no interface locale resolves.

use super::Message;

/// Render `msg` in English.
pub(super) fn text(msg: Message) -> &'static str {
    match msg {
        Message::ErrInvalidUsage => "invalid usage",
        Message::ErrInvalidInput => "invalid input",
        Message::ErrStdinEmpty => "stdin is empty",
        Message::ErrInvalidUrl => "invalid url",
        Message::ErrNoSubtitle => "no subtitle",
        Message::ErrProviderUnavailable => "providers unavailable",
        Message::ErrRateLimited => "rate limited by provider (HTTP 429)",
        Message::ErrTimeout => "timeout",
        Message::ErrIo => "io error",
        Message::ErrHttp => "http error",
        Message::ErrUrlParse => "url parse error",
        Message::ErrSerde => "serialization error",
        Message::ErrCrypto => "crypto error",
        Message::ErrSubtitleTooLarge => "subtitle exceeds limit",
        Message::ErrInternal => "internal error",
        Message::ErrPlayerResponseMissing => "player response missing",
        Message::ErrPlayerResponseTooLarge => "player response too large",
        Message::ErrCaptionTrackNotFound => "caption track not found",
        Message::ErrCaptionsAsrOnly => "only auto-generated captions, none deliverable",
        Message::ErrPlayabilityStatusDenied => "playability status denied",
        Message::ErrLanguageParse => "language parse error",
        Message::ErrSignatureDecipherFailed => "signature decipher failed",
        Message::ErrTimedtextUpstream => "timedtext upstream error",
        Message::ErrProviderProtocol => "provider protocol error",
        Message::ErrBrowserNotFound => "chromium/chrome not found",
        Message::ErrConfig => "config error",
        Message::ErrCaptchaChallengeFrom => "captcha challenge from",
        Message::ErrCaptchaHumanRequired => "human interaction required",
        Message::UnitBytes => "bytes",
        Message::WordExceeds => "exceeds",
        Message::WordAvailable => "available",

        Message::ReasonPrivateOrAgeRestricted => "video is private or age-restricted (HTTP 403)",
        Message::ReasonNotFound => "video not found (HTTP 404)",
        Message::ReasonGone => "video removed by author (HTTP 410)",
        Message::ReasonUnavailableForLegalReasons => {
            "video unavailable for legal reasons (HTTP 451)"
        }
        Message::ReasonNotPublished => "no captions published for this video",
        Message::ReasonLanguageUnavailable => "requested language is unavailable",

        Message::UsageBatchWithUrl => "--batch cannot be combined with a positional url",
        Message::UsageNoUrl => {
            "no url provided; pass a positional url, pipe through stdin, or use --batch"
        }
        Message::UsageUrlTooLong => "url exceeds 2048 characters",
        Message::UsageQuietWithVerbose => "--quiet cannot be combined with --verbose",
        Message::UsageTimeoutZero => "--timeout must be greater than zero",
        Message::UsageCacheTtlZero => "--cache-ttl must be greater than zero",
        Message::UsageDryRunWithBatch => "--dry-run cannot be combined with --batch",

        Message::ConfigCouldNotRead => "could not read config file",
        Message::ConfigNotValidToml => "is not valid TOML",
        Message::ConfigUnknownKey => "config: unknown key",
        Message::ConfigKeyPrefix => "config: key",
        Message::ConfigWrongType => "has wrong type, expected",
        Message::ConfigInvalidFormat => "config: invalid format (expected txt, srt or vtt)",
        Message::ConfigInvalidProvider => {
            "config: invalid provider (run --help for the accepted values)"
        }
        Message::ConfigInvalidLogLevel => {
            "config: invalid log_level (expected error, warn, info, debug or trace)"
        }
        Message::ConfigInvalidLogFormat => "config: invalid log_format (expected text or json)",
        Message::ConfigInvalidColor => "config: invalid color (expected auto, always or never)",
        Message::ConfigInvalidUiLang => "config: invalid ui_lang for this build",

        Message::LangInvalidTag => "not a valid BCP 47 language tag",
        Message::LangUnsupportedUi => "interface language not compiled into this build",

        Message::ErrTracingInit => "tracing init failed",
        Message::ConfigDirUnavailable => "could not determine the platform config directory",
        Message::ConfigKeyNotSet => "is not set; it uses the compiled default",
        Message::ConfigKeyIsSecret => {
            "is a secret; pass --from-stdin, because argv is visible in the process table to every user on the host"
        }
        Message::ConfigSetNeedsValue => "needs a value, or --from-stdin",
        Message::ConfigKeySetNeedsYes => "is currently set; pass the global --yes before the `config` subcommand to remove it",
        Message::ConfigUnknownKeyHint => "run `config list-keys` for the registry",
        Message::ConfigExpectsInteger => "expects an integer",
        Message::ConfigExpectsBoolean => "expects a boolean, got",
    }
}