Sign inSign up

jtenorio/document-translator

By jtenorio

Updated 11 months ago

Document translator, translates excel and powerpoint.

Image
Web servers
Content management system
0

1.0K

jtenorio/document-translator repository overview

Document Translator - Docker Image

Docker Hub Docker Image Size Docker Pulls

Document Translator - An Azure-powered web application that translates Excel spreadsheets and PowerPoint presentations between languages while preserving formatting, animations, and structure.

Supported Formats:

  • 📊 Excel: .xlsx, .xls
  • 📽️ PowerPoint: .pptx

Quick Start

Pull and Run
# Pull the latest image
docker pull jtenorio/document-translator:latest

# Run with your Azure Translator API key
docker run -d -p 8080:8080 \
  -e TranslationSettings__ApiKey="YOUR_AZURE_TRANSLATOR_API_KEY" \
  --name document-translator \
  jtenorio/document-translator:latest

Access the application at http://localhost:8080

Upload Excel (.xlsx, .xls) or PowerPoint (.pptx) files for translation!

Using Docker Compose

Create a docker-compose.yml file:

version: '3.8'

services:
  document-translator:
    image: jtenorio/document-translator:latest
    container_name: document-translator
    restart: unless-stopped
    ports:
      - "8080:8080"
    environment:
      - TranslationSettings__ApiKey=${TRANSLATOR_API_KEY}
      - TranslationSettings__Region=eastus2
      - TranslationSettings__SourceLanguage=auto
      - TranslationSettings__TargetLanguage=en

Create a .env file:

TRANSLATOR_API_KEY=your-azure-translator-api-key-here

Run:

docker compose up -d

Prerequisites

Getting Your Azure Translator API Key
  1. Sign in to the Azure Portal
  2. Create a new Translator resource (or use an existing one)
  3. Navigate to Keys and Endpoint
  4. Copy one of the keys (KEY 1 or KEY 2)
  5. Note your region (e.g., "eastus2")

Configuration

Environment Variables

Configure the application using environment variables:

VariableRequiredDefaultDescription
TranslationSettings__ApiKey? Yes-Azure Translator API key
TranslationSettings__RegionNoeastus2Azure region (e.g., eastus2, westus2)
TranslationSettings__SourceLanguageNoautoSource language code (e.g., es, en, fr, or auto for auto-detect)
TranslationSettings__TargetLanguageNoenTarget language code (e.g., en, es, de)
TranslationSettings__BatchSizeNo100Cells/paragraphs per API call (optimize for performance)
TranslationSettings__BatchDelayMillisecondsNo100Delay between batches (ms)
AllowedHostsNo*Allowed host headers (semicolon-separated)
ASPNETCORE_ENVIRONMENTNoProductionEnvironment (Production/Development)
Proper Nouns (Words Not to Translate)

To specify proper nouns that should not be translated, use a JSON array:

docker run -d -p 8080:8080 \
  -e TranslationSettings__ApiKey="YOUR_API_KEY" \
  -e TranslationSettings__ProperNouns__0="Carlos" \
  -e TranslationSettings__ProperNouns__1="Maria" \
  -e TranslationSettings__ProperNouns__2="YourCompanyName" \
  jtenorio/document-translator:latest
Language Codes

Supported languages include:

  • auto - Auto-detect (source language only)
  • en - English
  • es - Spanish
  • fr - French
  • de - German
  • it - Italian
  • pt - Portuguese
  • ja - Japanese
  • ko - Korean
  • zh-Hans - Chinese (Simplified)
  • zh-Hant - Chinese (Traditional)
  • ar - Arabic
  • ru - Russian
  • hi - Hindi
  • nl - Dutch
  • pl - Polish
  • tr - Turkish
  • vi - Vietnamese
  • th - Thai
  • And 100+ more...

See Azure Translator Language Support for the complete list.

Reverse Proxy Deployment

For production deployments, use a reverse proxy (Nginx, Apache, Traefik) for HTTPS termination and load balancing.

Configuration

Enable reverse proxy mode when deploying behind a proxy:

version: '3.8'

services:
  document-translator:
    image: jtenorio/document-translator:latest
    container_name: document-translator
    restart: unless-stopped
    environment:
      - TranslationSettings__ApiKey=${TRANSLATOR_API_KEY}
      - ReverseProxy__Enabled=true
      - ReverseProxy__KnownNetworks=172.17.0.0/16
      - AllowedHosts=yourdomain.com;*.yourdomain.com
    networks:
      - backend
    expose:
      - "8080"

  nginx:
    image: nginx:alpine
    container_name: nginx-proxy
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
      - ./ssl:/etc/nginx/ssl:ro
    networks:
      - backend
    depends_on:
      - document-translator

networks:
  backend:
    driver: bridge
Reverse Proxy Environment Variables
VariableDefaultDescription
ReverseProxy__EnabledfalseEnable reverse proxy mode
ReverseProxy__KnownNetworks(empty)Trusted proxy networks (CIDR notation, comma-separated)
ReverseProxy__KnownProxies(empty)Trusted proxy IPs (comma-separated)
ReverseProxy__ForwardLimit1Number of proxies to trust
ReverseProxy__ForwardedForHeaderNameX-Forwarded-ForHeader name for client IP
Nginx Configuration Example

Create nginx.conf:

upstream document_translator {
    server document-translator:8080;
}

server {
    listen 443 ssl http2;
    server_name translate.yourdomain.com;

    ssl_certificate /etc/nginx/ssl/cert.pem;
    ssl_certificate_key /etc/nginx/ssl/key.pem;

    location / {
        proxy_pass http://document_translator;
        proxy_http_version 1.1;

        # Required for Blazor Server SignalR
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        # Forwarded headers
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;

        # Timeouts for long translations
        proxy_connect_timeout 300s;
        proxy_send_timeout 300s;
        proxy_read_timeout 300s;

        # File upload support
        client_max_body_size 50M;
    }
}

server {
    listen 80;
    server_name translate.yourdomain.com;
    return 301 https://$server_name$request_uri;
}
What Reverse Proxy Mode Does

When ReverseProxy__Enabled=true:

  • Processes forwarded headers (X-Forwarded-For, X-Forwarded-Proto, X-Forwarded-Host)
  • Disables HTTPS redirection (proxy handles HTTPS termination)
  • Disables HSTS (proxy should set HSTS headers)
  • Detects real client IP for logging and rate limiting
  • Respects proxy scheme for URL generation
Security Considerations

Important: Only trust proxies you control!

  1. Always specify trusted proxies in production:

    ReverseProxy__KnownNetworks=172.17.0.0/16
    
  2. Set AllowedHosts to your domain:

    AllowedHosts=yourdomain.com;*.yourdomain.com
    
  3. Never expose port 8080 publicly - Only to the proxy

  4. Use HTTPS at the proxy - Free with Let's Encrypt

Advanced Usage

Custom Port Binding
docker run -d -p 3000:8080 \
  -e TranslationSettings__ApiKey="YOUR_API_KEY" \
  jtenorio/document-translator:latest

Access at http://localhost:3000

Mount Volume for Logs
docker run -d -p 8080:8080 \
  -v $(pwd)/logs:/app/logs \
  -e TranslationSettings__ApiKey="YOUR_API_KEY" \
  jtenorio/document-translator:latest
Development Mode
docker run -d -p 8080:8080 \
  -e TranslationSettings__ApiKey="YOUR_API_KEY" \
  -e ASPNETCORE_ENVIRONMENT=Development \
  jtenorio/document-translator:latest

Image Details

  • Repository: jtenorio/document-translator
  • Supported Formats: Excel (.xlsx, .xls) and PowerPoint (.pptx)
  • Base Image: mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine
  • Size: ~280MB (optimized with Alpine Linux)
  • Runtime: .NET 8.0 LTS
  • Architecture: linux/amd64
  • Exposed Port: 8080
  • Health Check: Built-in HTTP health check
  • User: Non-root user (uid 1000)
Available Tags
  • latest - Latest stable release (v2.0+ with PowerPoint support)
  • 2.0.0 - Version 2.0 (PowerPoint support added)
  • 2.0 - Major.minor version
  • 1.0.0 - Version 1.0 (Excel only - deprecated)
# Pull specific version
docker pull jtenorio/document-translator:2.0.0

# Pull latest (recommended)
docker pull jtenorio/document-translator:latest

Health Check

The image includes a built-in health check:

# Check container health
docker inspect --format='{{.State.Health.Status}}' document-translator

Manual health check:

curl http://localhost:8080/

Logs and Troubleshooting

View Logs
# View all logs
docker logs document-translator

# Follow logs in real-time
docker logs -f document-translator

# View last 100 lines
docker logs --tail 100 document-translator
Common Issues
Container exits immediately

Cause: Missing or invalid API key
Solution: Verify the TranslationSettings__ApiKey environment variable

docker logs document-translator
Can't connect to http://localhost:8080

Solution: Check if container is running

docker ps
docker port document-translator
Translation fails

Cause: Invalid API key or region
Solution: Verify your Azure Translator credentials

# Test with correct region
docker run -d -p 8080:8080 \
  -e TranslationSettings__ApiKey="YOUR_API_KEY" \
  -e TranslationSettings__Region="eastus2" \
  jtenorio/document-translator:latest
File upload fails

Cause: File too large
Solution: Increase reverse proxy body size limit (if using proxy)

# In nginx.conf
client_max_body_size 50M;

Updating

Pull Latest Version
# Pull latest image
docker pull jtenorio/document-translator:latest

# Stop and remove old container
docker stop document-translator
docker rm document-translator

# Run new version
docker run -d -p 8080:8080 \
  -e TranslationSettings__ApiKey="YOUR_API_KEY" \
  --name document-translator \
  jtenorio/document-translator:latest
With Docker Compose
# Pull latest and restart
docker compose pull
docker compose up -d

Security Best Practices

1. Use Environment Variables

Never hardcode API keys in configuration files:

# Good - use environment variables
docker run -d -p 8080:8080 \
  -e TranslationSettings__ApiKey="${TRANSLATOR_API_KEY}" \
  jtenorio/document-translator:latest
2. Restrict Network Access
# Docker Compose with network isolation
services:
  document-translator:
    image: jtenorio/document-translator:latest
    networks:
      - internal
    expose:
      - "8080"  # Don't publish to host
3. Use Secrets Management

For production, use Docker secrets or external secret management:

# Using Docker secrets
docker secret create translator_api_key api_key.txt
docker service create \
  --secret translator_api_key \
  -e TranslationSettings__ApiKey_File=/run/secrets/translator_api_key \
  jtenorio/document-translator:latest
4. Keep Image Updated
# Check for updates regularly
docker pull jtenorio/document-translator:latest

Additional Resources

License

See the GitHub repository for license information.

Support

Features

Excel Translation
  • Translate Excel files (.xlsx, .xls) between 100+ languages
  • Preserve cell formatting, styles, and colors
  • Maintain formulas and cell references
  • Translate sheet names
  • Batch processing for efficiency
PowerPoint Translation (v2.0+)
  • Translate PowerPoint presentations (.pptx)
  • Context-aware paragraph-level translation (preserves spacing)
  • Preserve slide layouts, animations, and transitions
  • Translate speaker notes
  • Maintain all formatting and styles
General Features
  • Multi-language support with auto-detection
  • Proper noun protection (configurable)
  • Progress tracking
  • Blazor-based responsive web UI
  • Azure Translator integration
  • Docker-ready deployment
  • Reverse proxy support
  • Security headers and rate limiting
  • Health checks and monitoring

Made with .NET by Darth Seldon | Because even the Dark Side needs multilingual documents!

Tag summary

Content type

Image

Digest

sha256:edba1adff

Size

116.9 MB

Last updated

11 months ago

docker pull jtenorio/document-translator