Skip to content

Conversation

@Moskize91
Copy link
Contributor

No description provided.

@Moskize91 Moskize91 requested a review from Copilot July 8, 2025 05:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors spine processing to support a single spine file, enhances chunk translation flow with better caching and error handling, updates the storage format for cached translations, and includes the target language in chunk hashing.

  • Consolidate spine file handling into a single tuple (spine) and adjust read/write logic.
  • Streamline future-based translation with a generator and add length checks for cached chunks.
  • Change cache storage to use simple newline splitting and drop whitespace cleaning.
  • Incorporate target_language into the hashing routine to avoid cross-language collisions.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
epub_translator/translator.py Refactored _translate_spine to use a single spine tuple for read/write logic
epub_translator/translation/translation.py Added _generate_chunks_from_futures, length mismatch warning in _translate_chunk
epub_translator/translation/store.py Switched to file.read().split("\n") and removed clean_spaces on write
epub_translator/translation/chunk.py Updated _hash_texts_list signature to include target_language
Comments suppressed due to low confidence (1)

epub_translator/translation/chunk.py:48

  • [nitpick] Using the variable name hash shadows the built-in function. Consider renaming to digest or chunk_hash to avoid confusion.
    hash = _hash_texts_list(target_language, (head, body, tail))

@Moskize91 Moskize91 merged commit 66daf01 into main Jul 8, 2025
1 check passed
@Moskize91 Moskize91 deleted the fix branch July 8, 2025 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants