iksnae / actual-intelligence

A practical, non-technical guide to using AI tools like ChatGPT in everyday life
MIT License
0 stars 0 forks source link

Fix multilingual build issue for Spanish content #47

Closed khaos-codi closed 3 months ago

khaos-codi commented 3 months ago

PR Description

This pull request addresses Issue #46 by fixing the multilingual book generation system, ensuring that Spanish books are properly built with images in addition to the English version.

Changes Made

  1. Enhanced build-language.sh:

    • Improved directory structure handling for non-English languages
    • Added explicit creation of language subdirectories and image directories
    • Added more detailed logging for easier debugging
    • Fixed path handling for Spanish content
  2. Enhanced generate-epub.sh:

    • Improved language-specific resource path handling
    • Added better cover image detection based on language
    • Enhanced error handling and fallback mechanisms
    • Added more detailed debug output for build failures
    • Adjusted file size thresholds for diagnostics
  3. Enhanced combine-markdown.sh:

    • Added better error handling for missing language directories
    • Improved diagnostic messages when content is missing
    • Added file size checks to verify output
  4. Added setup.sh improvements:

    • Added proper setup script to handle multilingual environment initialization
    • Added explicit handling of language-specific cover images
    • Created appropriate directory structure from the beginning
  5. Fixed build workflow:

    • Added additional debugging to track image inclusion
    • Improved language selection logic
    • Added redundant copy steps to ensure Spanish files appear in the root directory
  6. Added testing tools:

    • Created dedicated test scripts to isolate and verify Spanish builds

Testing

These changes have been designed to fix the Spanish book generation without affecting the existing English generation that's working properly. When the --all-languages flag is used, both English and Spanish books should now be generated with images properly included.

The key issues fixed:

  1. Resource paths not properly including chapter-specific images
  2. Language-specific cover images not being detected correctly
  3. Spanish output files not being copied to the root directory
  4. Poor error handling hiding the specific build failures

Fixes #46