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.
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
# 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.txt
Choose 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 DEBUG
Input Structure:
templates/
βββ index.html # Main landing page
βββ about.html # Additional pages
βββ contact.html # More pages
Command:
python langding.py --process-templates
Generated 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
export OPENAI_API_KEY='sk-your-key-here'
export AI_PROVIDER='openai'
export ANTHROPIC_API_KEY='sk-ant-your-key-here'
export AI_PROVIDER='anthropic'
Logs are stored in logs/langding.log
with automatic rotation:
timestamp - logger - level - message
DEBUG
: Detailed diagnostic informationINFO
: General operational messagesWARNING
: Warning messages for potential issuesERROR
: Error messages for failed operationsFor any inquiries or support, please open an issue or contact r6ty5r296it6tl4eg5m.constant214@passinbox.com.