Spaces:
Sleeping
Sleeping
Commit
·
c306eb7
1
Parent(s):
fb6b1e8
Upd syntax
Browse files- vi/processing.py +3 -3
vi/processing.py
CHANGED
|
@@ -155,7 +155,7 @@ def translate_sft_row(row: Dict[str, Any], translator, text_fields: List[str] =
|
|
| 155 |
logger.debug(f" Are they the same? {original == translated}")
|
| 156 |
|
| 157 |
# Validate and sanitize translated field
|
| 158 |
-
|
| 159 |
translated_sft[field] = _vi_sanitize_text(translated)
|
| 160 |
logger.debug(f"✅ Successfully translated field '{field}'")
|
| 161 |
# Add success statistics if stats available
|
|
@@ -173,8 +173,8 @@ def translate_sft_row(row: Dict[str, Any], translator, text_fields: List[str] =
|
|
| 173 |
logger.error(f"Failed to translate field '{field}': {e}")
|
| 174 |
translated_sft[field] = sft_data[field]
|
| 175 |
else:
|
| 176 |
-
|
| 177 |
-
|
| 178 |
|
| 179 |
# Update the translated row
|
| 180 |
translated_row["sft"] = translated_sft
|
|
|
|
| 155 |
logger.debug(f" Are they the same? {original == translated}")
|
| 156 |
|
| 157 |
# Validate and sanitize translated field
|
| 158 |
+
if _validate_vi_translation(original, translated):
|
| 159 |
translated_sft[field] = _vi_sanitize_text(translated)
|
| 160 |
logger.debug(f"✅ Successfully translated field '{field}'")
|
| 161 |
# Add success statistics if stats available
|
|
|
|
| 173 |
logger.error(f"Failed to translate field '{field}': {e}")
|
| 174 |
translated_sft[field] = sft_data[field]
|
| 175 |
else:
|
| 176 |
+
# Keep original if field doesn't exist or is empty
|
| 177 |
+
translated_sft[field] = sft_data.get(field, "")
|
| 178 |
|
| 179 |
# Update the translated row
|
| 180 |
translated_row["sft"] = translated_sft
|