mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-06-09 06:18:46 +08:00
Add a new comand convert to convert between outputt script types
This commit is contained in:
25
src/types.rs
25
src/types.rs
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user