@@ -279,6 +279,7 @@ async def translate_content(
279279
280280 # Restore statistics
281281 stats = TranslationMetrics .from_dict (resume_state .stats ) if resume_state .stats else TranslationMetrics ()
282+ stats .total_chunks = len (chunks ) # Ensure total_chunks is set from restored chunks
282283
283284 # Restore tag_preserver
284285 tag_preserver = self .tag_preserver
@@ -319,6 +320,10 @@ async def translate_content(
319320 metadata = context ['metadata' ]
320321
321322 # 4. Translation with checkpoint support
323+ # For DOCX, we have a single file so global stats = local stats
324+ total_chunks = len (chunks )
325+ completed_chunks = len (translated_chunks ) if translated_chunks else 0
326+
322327 translated_chunks , stats , was_interrupted = await _translate_all_chunks_with_checkpoint (
323328 chunks = chunks ,
324329 source_language = source_language ,
@@ -340,6 +345,9 @@ async def translate_content(
340345 global_tag_map = global_tag_map ,
341346 stats = stats ,
342347 prompt_options = prompt_options ,
348+ # Pass global stats for DOCX (single file = global stats)
349+ global_total_chunks = total_chunks ,
350+ global_completed_chunks = completed_chunks ,
343351 )
344352
345353 # If interrupted, save state and return partial result
0 commit comments