Add a new comand convert to convert between outputt script types

This commit is contained in:
2025-12-30 11:18:26 +08:00
parent 7670570a88
commit f58ffd290b
5 changed files with 496 additions and 1 deletions

View File

@@ -130,6 +130,18 @@ impl OutputScriptType {
OutputScriptType::M3t | OutputScriptType::M3ta | OutputScriptType::M3tTxt
)
}
/// Returns true if the script type supports source messages.
pub fn is_src_supported(&self) -> bool {
matches!(
self,
OutputScriptType::M3t
| OutputScriptType::M3ta
| OutputScriptType::M3tTxt
| OutputScriptType::Po
| OutputScriptType::Pot
)
}
}
impl AsRef<str> for OutputScriptType {
@@ -764,6 +776,19 @@ impl Message {
}
}
#[derive(Clone, Debug)]
/// Extended message structure for scripts
pub struct ExtendedMessage {
/// Optional name for the message, used in some scripts.
pub name: Option<String>,
/// Original source text.
pub source: String,
/// Translated text.
pub translated: String,
/// Optional LLM translated text.
pub llm: Option<String>,
}
/// Result of script operation.
pub enum ScriptResult {
/// Operation completed successfully.