pub struct TranslateArgs {
pub paths: Vec<PathBuf>,
pub input_paths: Vec<PathBuf>,
pub recursive: bool,
pub target_language: Option<String>,
pub source_language: Option<String>,
pub glossary: Option<PathBuf>,
pub context: Option<String>,
pub output: Option<PathBuf>,
pub no_extract: bool,
pub force: bool,
pub replace: bool,
}Expand description
Command-line arguments for AI-assisted subtitle translation.
All input collection flags follow the same conventions as the other
mutating subtitle commands. Validation rules are intentionally enforced
before any AI call so that user mistakes (missing glossary file, empty
--target-language, etc.) do not consume API quota.
Fields§
§paths: Vec<PathBuf>Positional file or directory paths to translate.
input_paths: Vec<PathBuf>Specify file or directory paths to process via repeated -i/--input.
recursive: boolRecursively process subdirectories.
target_language: Option<String>Required target language code or name (for example, zh-TW, ja,
English). When omitted on the CLI, the value falls back to
translation.default_target_language from configuration; if neither
is provided the command fails with a usage-style error.
source_language: Option<String>Optional source language hint. When omitted, the AI provider is asked to detect or accept the source language automatically.
glossary: Option<PathBuf>Path to a UTF-8 text glossary file. Glossary entries take precedence over the AI-generated terminology map.
context: Option<String>Inline context guidance forwarded to the translation prompt (for
example, "Use formal business tone").
output: Option<PathBuf>Output file (single-input mode) or directory (batch mode) for the translated subtitle(s).
no_extract: boolDisable automatic archive extraction for -i inputs.
force: boolOverwrite existing translated output files.
--overwrite is accepted as a visible alias for consistency with the
user-facing command documentation.
replace: boolReplace each source subtitle file with its translated content. Existing backup settings still apply.
Implementations§
Source§impl TranslateArgs
impl TranslateArgs
Sourcepub fn validate(&self) -> Result<(), SubXError>
pub fn validate(&self) -> Result<(), SubXError>
Validate the user-supplied arguments before invoking the translation engine.
Note: presence of a target language is validated by the command
handler after combining CLI input with configured defaults; this
function only validates that an explicitly provided --target-language
is non-empty, along with the other guidance options.
§Errors
Returns SubXError::CommandExecution when:
--target-languageis provided but empty after trimming.--source-languageis provided but empty after trimming.--contextis provided but empty after trimming.--glossarypoints to a path that does not exist or is not a file.
Sourcepub fn get_input_handler(&self) -> Result<InputPathHandler, SubXError>
pub fn get_input_handler(&self) -> Result<InputPathHandler, SubXError>
Build an InputPathHandler from positional and -i paths,
scoped to the subtitle file extensions supported by the rest of the
pipeline.
Trait Implementations§
Source§impl Args for TranslateArgs
impl Args for TranslateArgs
Source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command so it can instantiate self via
FromArgMatches::update_from_arg_matches_mut Read moreSource§impl Clone for TranslateArgs
impl Clone for TranslateArgs
Source§fn clone(&self) -> TranslateArgs
fn clone(&self) -> TranslateArgs
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TranslateArgs
impl Debug for TranslateArgs
Source§impl FromArgMatches for TranslateArgs
impl FromArgMatches for TranslateArgs
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.