Langding is an AI-driven landing page auto-translation tool designed for developers who need to localize their websites efficiently. It extracts meaningful content from HTML files, translates it using advanced AI models (OpenAI GPT or Anthropic Claude), and generates complete multilingual versions with automatic language detection.
- π€ AI-Powered Translation: Leverages OpenAI GPT or Anthropic Claude for context-aware translations
- π Multi-Language Support: Supports 10+ languages with automatic browser detection
- π Smart Template System: Generates reusable templates with intelligent placeholder mapping
- π Auto-Redirect Generation: Creates language detection and redirect pages
- β‘ Batch Processing: Efficiently processes multiple HTML files
- ποΈ Flexible Configuration: Environment-based and CLI configuration options
| π― Core Sections | π Technical Docs | π Advanced Usage |
|---|---|---|
| β¨ Features | π§ Environment Variables | π Processing Templates |
| π οΈ Installation | ποΈ Command Line Options | π€ AI Provider Setup |
| βοΈ Configuration | π Logging | π Examples |
| π Usage | π License | π« Contact |
graph TD
A[HTML Input] --> B[Content Extraction]
B --> C{AI Translation}
C -->|OpenAI GPT| D[Context-Aware Translation]
C -->|Anthropic Claude| D
D --> E[Template Generation]
E --> F[Multi-Language Output]
F --> G[Auto-Redirect Pages]
H[Configuration] --> C
H --> I[Environment Variables]
H --> J[CLI Arguments]
K[Logging System] --> L[Rotation & Monitoring]
style A fill:#e1f5fe
style F fill:#f3e5f5
style G fill:#fff3e0
style C fill:#e8f5e8
- Smart Content Extraction: Prioritizes headings, paragraphs, and meta content
- Context Preservation: Maintains technical accuracy and professional tone
- Template Generation: Creates reusable placeholders for efficient processing
- OpenAI GPT Integration: Support for GPT-3.5-turbo and GPT-4 models
- Anthropic Claude Integration: Claude-3-haiku and Claude-3-sonnet support
- Provider Switching: Easy configuration between AI providers
- Structured File Generation: Organized output with language-specific files
- Auto-Redirect System: Browser language detection with fallback support
- GitHub Pages Ready: Direct deployment compatibility
- Python 3.11+
- Git
- AI API Key (OpenAI OR Anthropic)
# Clone repository
git clone https://github.com/JuanVilla424/langding.git
cd langding
# Setup virtual environment
python -m venv venv
source venv/bin/activate # Windows: .\venv\Scripts\activate
# Install dependencies
pip install --upgrade pip
pip install -r requirements.txtChoose ONE provider:
Option A: OpenAI
export OPENAI_API_KEY='sk-your-openai-key-here'
export AI_PROVIDER='openai'Option B: Anthropic Claude
export ANTHROPIC_API_KEY='sk-ant-your-anthropic-key-here'
export AI_PROVIDER='anthropic'Create .env file:
# Output Configuration
OUTPUT_DIR=output
# Language Selection (JSON format)
LANGS=["English","Spanish","French","German","Portuguese","Italian","Japanese","Korean","Chinese","Arabic"]
# AI Provider Selection
AI_PROVIDER=openai # Options: openai, anthropic
# OpenAI Configuration
OPENAI_API_KEY=your-openai-api-key-here
OPENAI_MODEL=gpt-3.5-turbo
# Anthropic Configuration
ANTHROPIC_API_KEY=your-anthropic-api-key-here
ANTHROPIC_MODEL=claude-3-haiku-20240307| Variable | Description | Default | Required |
|---|---|---|---|
OUTPUT_DIR |
Output directory for generated files | output |
β |
LANGS |
Target languages (JSON array) | ["English","Spanish","French","German"] |
β |
AI_PROVIDER |
AI service provider | openai |
β |
OPENAI_API_KEY |
OpenAI API key | - | β (if using OpenAI) |
ANTHROPIC_API_KEY |
Anthropic API key | - | β (if using Anthropic) |
OPENAI_MODEL |
OpenAI model name | gpt-3.5-turbo |
β |
ANTHROPIC_MODEL |
Anthropic model name | claude-3-haiku-20240307 |
β |
# Process templates directory
python langding.py --process-templates
# Process custom input directory
python langding.py --input-dir input_html --output-dir translated_html
# Specify target languages
python langding.py --process-templates --languages Spanish French German
# Enable debug logging
python langding.py --process-templates --log-level DEBUGInput Structure:
templates/
βββ index.html # Main landing page
βββ about.html # Additional pages
βββ contact.html # More pages
Command:
python langding.py --process-templatesGenerated Output:
output/
βββ index.html # Auto-redirect page
βββ english_index.html # English version
βββ spanish_index.html # Spanish version
βββ french_index.html # French version
βββ template_index.html # Template with placeholders
βββ index_translations.json # Translation metadata
python langding.py [OPTIONS]
Options:
--input-dir TEXT Input directory containing HTML files
--output-dir TEXT Output directory for generated files
--template-dir TEXT Template directory (default: templates)
--languages TEXT... Target languages for translation
--log-level CHOICE Logging level [DEBUG|INFO|WARNING|ERROR]
--process-templates Process files from templates directory
--help Show help message and exit# Translate templates to Spanish and French
python langding.py --process-templates --languages Spanish French# Custom directories with specific languages
python langding.py \
--input-dir my_website \
--output-dir translations \
--languages English Spanish Portuguese Italian \
--log-level INFO# Debug mode with detailed logging
python langding.py --process-templates --log-level DEBUG- Get API key from OpenAI Platform
- Set environment variables:
export OPENAI_API_KEY='sk-your-key-here'
export AI_PROVIDER='openai'- Get API key from Anthropic Console
- Set environment variables:
export ANTHROPIC_API_KEY='sk-ant-your-key-here'
export AI_PROVIDER='anthropic'Logs are stored in logs/langding.log with automatic rotation:
- File Size Limit: 5MB per file
- Backup Count: 5 files maximum
- Format:
timestamp - logger - level - message
DEBUG: Detailed diagnostic informationINFO: General operational messagesWARNING: Warning messages for potential issuesERROR: Error messages for failed operations
For any inquiries or support, please open an issue or contact r6ty5r296it6tl4eg5m.constant214@passinbox.com.
2025 β This project is licensed under the GNU General Public License v3.0. You are free to use, modify, and distribute this software under the terms of the GPL-3.0 license. For more details, please refer to the LICENSE file included in this repository.