I've analyzed the current issue with the Spanish book generation and found that while the PR #47 tried to address this, there are still issues with how the Docker container is handling the Spanish content. Here's a comprehensive fix:
Root Causes Identified:
Resource Path Issues: The Spanish resource paths aren't consistently handled across all conversion tools
Language-specific Metadata: The metadata for Spanish books needs explicit language tags in all conversion steps
Docker Container Configuration: The book-builder container may need additional configuration for multilingual support
File Copying Logic: The file copying in the build script needs to be more explicit about maintaining the Spanish files
Proposed Fixes:
Update the generate-epub.sh script to explicitly handle language codes:
# In tools/scripts/generate-epub.sh, modify the container's generate-epub command:
# Add language as first-class parameter
generate-epub \
--title "$BOOK_TITLE" \
--author "Open Source Community" \
--publisher "Khaos Studios" \
--language "$LANGUAGE" \
--resource-path "$RESOURCE_PATHS" \
--verbose \
"$INPUT_FILE" "$OUTPUT_FILE"
Modify build-language.sh to ensure proper file staging for non-English versions:
# In tools/scripts/build-language.sh, add explicit copy operations:
# At the end of the script, add:
if [ "$LANGUAGE" != "en" ]; then
echo "Ensuring $LANGUAGE files are copied to root build directory for release..."
# Make sure files exist before copying
if [ -f "$PDF_PATH" ]; then
echo "Copying $PDF_PATH to build/$PDF_FILENAME"
cp "$PDF_PATH" "build/$PDF_FILENAME"
else
echo "⚠️ Warning: $PDF_PATH does not exist, cannot copy to root build directory"
fi
if [ -f "$EPUB_PATH" ]; then
echo "Copying $EPUB_PATH to build/$EPUB_FILENAME"
cp "$EPUB_PATH" "build/$EPUB_FILENAME"
else
echo "⚠️ Warning: $EPUB_PATH does not exist, cannot copy to root build directory"
fi
if [ -f "$MOBI_PATH" ]; then
echo "Copying $MOBI_PATH to build/$MOBI_FILENAME"
cp "$MOBI_PATH" "build/$MOBI_FILENAME"
else
echo "⚠️ Warning: $MOBI_PATH does not exist, cannot copy to root build directory"
fi
if [ -f "$HTML_PATH" ]; then
echo "Copying $HTML_PATH to build/$HTML_FILENAME"
cp "$HTML_PATH" "build/$HTML_FILENAME"
else
echo "⚠️ Warning: $HTML_PATH does not exist, cannot copy to root build directory"
fi
fi
Add explicit verification in the GitHub workflow for Spanish files:
# In .github/workflows/build-book.yml, add a verification step:
- name: Verify Spanish build outputs
run: |
echo "=== Verifying Spanish Files ==="
if [ -f "build/inteligencia-real.pdf" ]; then
echo "✅ Spanish PDF exists"
du -h build/inteligencia-real.pdf
else
echo "❌ Spanish PDF missing"
fi
if [ -f "build/inteligencia-real.epub" ]; then
echo "✅ Spanish EPUB exists"
du -h build/inteligencia-real.epub
else
echo "❌ Spanish EPUB missing"
fi
if [ -f "build/inteligencia-real.mobi" ]; then
echo "✅ Spanish MOBI exists"
du -h build/inteligencia-real.mobi
else
echo "❌ Spanish MOBI missing"
fi
echo "=== Checking Language-Specific Directories ==="
find build -type d -name "es" | xargs ls -la
Enhance Docker book-builder image to better support localization:
# Add to book-builder Dockerfile:
# Install additional localization packages
RUN apt-get update && apt-get install -y \
locales \
language-pack-es \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Generate all locales
RUN locale-gen en_US.UTF-8
RUN locale-gen es_ES.UTF-8
Testing Steps:
Implement these changes in a new branch
Verify both English and Spanish books build correctly
Ensure files are copied to the appropriate locations
Validate the release workflow includes both language versions
This approach should ensure that:
All language-specific resources are properly handled
Files are explicitly copied where they need to be
The build system has better verification and error reporting
The Docker container is properly configured for multilingual support
Let me know if you'd like me to implement this fix in a PR.
Spanish Book Generation Issue Analysis
I've analyzed the current issue with the Spanish book generation and found that while the PR #47 tried to address this, there are still issues with how the Docker container is handling the Spanish content. Here's a comprehensive fix:
Root Causes Identified:
Proposed Fixes:
Testing Steps:
This approach should ensure that:
Let me know if you'd like me to implement this fix in a PR.