mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-09-18 08:14:55 +08:00
feat(translation): add Rust Translation Memory and config migration
This commit is contained in:
@@ -91,6 +91,12 @@ pub struct LocalizedPatchOperationMetadata {
|
||||
/// Provider run ID that produced the text, if applicable.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub provider_run_id: Option<String>,
|
||||
/// Source kind of the translation result.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub translation_source_kind: Option<String>,
|
||||
/// Trusted Translation Memory record used for the text, if applicable.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub translation_memory_record_id: Option<String>,
|
||||
/// Review state used by the publication input.
|
||||
pub review_status: String,
|
||||
}
|
||||
@@ -331,6 +337,12 @@ pub struct LocalizedPatchOperation {
|
||||
/// Provider run ID that produced the text, if applicable.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub provider_run_id: Option<String>,
|
||||
/// Source kind of the translation result.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub translation_source_kind: Option<String>,
|
||||
/// Trusted Translation Memory record used for the text, if applicable.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub translation_memory_record_id: Option<String>,
|
||||
/// Review state used by the publication input.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub review_status: Option<String>,
|
||||
@@ -941,6 +953,8 @@ impl LocalizedPatchOperation {
|
||||
source_text_blake3: None,
|
||||
translation_provider: None,
|
||||
provider_run_id: None,
|
||||
translation_source_kind: None,
|
||||
translation_memory_record_id: None,
|
||||
review_status: None,
|
||||
},
|
||||
metadata,
|
||||
@@ -966,6 +980,8 @@ impl LocalizedPatchOperation {
|
||||
source_text_blake3: None,
|
||||
translation_provider: None,
|
||||
provider_run_id: None,
|
||||
translation_source_kind: None,
|
||||
translation_memory_record_id: None,
|
||||
review_status: None,
|
||||
},
|
||||
metadata,
|
||||
@@ -990,6 +1006,8 @@ impl LocalizedPatchOperation {
|
||||
source_text_blake3: None,
|
||||
translation_provider: None,
|
||||
provider_run_id: None,
|
||||
translation_source_kind: None,
|
||||
translation_memory_record_id: None,
|
||||
review_status: None,
|
||||
},
|
||||
metadata,
|
||||
@@ -1005,6 +1023,8 @@ impl LocalizedPatchOperation {
|
||||
operation.source_text_blake3 = Some(metadata.source_text_blake3.clone());
|
||||
operation.translation_provider = metadata.translation_provider.clone();
|
||||
operation.provider_run_id = metadata.provider_run_id.clone();
|
||||
operation.translation_source_kind = metadata.translation_source_kind.clone();
|
||||
operation.translation_memory_record_id = metadata.translation_memory_record_id.clone();
|
||||
operation.review_status = Some(metadata.review_status.clone());
|
||||
}
|
||||
operation
|
||||
@@ -1029,6 +1049,8 @@ impl Default for LocalizedPatchOperation {
|
||||
source_text_blake3: None,
|
||||
translation_provider: None,
|
||||
provider_run_id: None,
|
||||
translation_source_kind: None,
|
||||
translation_memory_record_id: None,
|
||||
review_status: None,
|
||||
}
|
||||
}
|
||||
@@ -1401,6 +1423,8 @@ mod tests {
|
||||
source_text_blake3: Some(blake3::hash(source).to_hex().to_string()),
|
||||
translation_provider: Some("mock".to_string()),
|
||||
provider_run_id: Some("mock:unit-1:attempt-1".to_string()),
|
||||
translation_source_kind: Some("provider".to_string()),
|
||||
translation_memory_record_id: None,
|
||||
review_status: Some("provider_completed".to_string()),
|
||||
}],
|
||||
}],
|
||||
|
||||
Reference in New Issue
Block a user