Translate and Localize with Grok
**AI-powered WordPress translation and localization** using Grok API with Polylang integration and background processing.
by Winners Media Limited · github.com/winnersmedia/translate-and-localize · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/winnersmedia/translate-and-localize/archive/refs/heads/main.zipAI-powered WordPress translation and localization using Grok API with Polylang integration and background processing.
🚨 Problem Solved
Are you experiencing these WordPress translation challenges?
- ✅ Manual translation takes hours for each post
- ✅ Generic translations that don't resonate with local audiences
- ✅ Cloudflare timeouts during translation processing
- ✅ Lost cultural context in machine translations
- ✅ No localization - just word-for-word translation
- ✅ Broken HTML formatting after translation
- ✅ Server timeouts on long content
- ✅ No background processing for translations
This plugin solves all these problems with AI-powered translation and localization.
🔥 Key Features
⚡ AI-Powered Translation & Localization
- Grok AI integration for intelligent translations
- Cultural adaptation not just word-for-word translation
- Maintains tone and style of original content
- Adapts idioms and expressions for target audience
🛡️ Cloudflare & Timeout Protection
- Background queue processing prevents timeouts
- Works with Cloudflare 100-second limit
- Chunked processing for large content
- Automatic retry on failures
🎯 Seamless Polylang Integration
- One-click translation from post editor
- Updates existing posts with translated content
- Preserves post status (published, draft, etc.)
- Maintains all metadata and custom fields
🛠️ Professional Features
- Customizable prompts for different content types
- Multiple Grok models to choose from
- HTML formatting preservation
- Progress tracking with real-time updates
- Queue management dashboard
🚀 Installation
- Download the plugin files
- Upload to
/wp-content/plugins/translate-and-localize/ - Activate the plugin through WordPress admin
- Ensure Polylang is installed and activated
- Go to Settings → Translate & Localize
- Add your Grok API key
- Configure your translation preferences
⚙️ Configuration
1. Get Your Grok API Key
- Visit xAI Console
- Sign up or log in to your account
- Navigate to API Keys section
- Create a new API key
- Copy and paste in plugin settings
2. Plugin Settings
- API Key: Your Grok API key from xAI
- Model: Enter the model name (e.g., grok-beta, grok-2-beta) - check xAI docs for latest models
- Default Prompt: Customize how content is translated
- Batch Size: Number of items to process (1-10)
- Request Timeout: API timeout in seconds (30-300)
- Test Connection: Verify your API key and model are working
3. Prompt Customization
Available placeholders:
{source_lang}- Source language code{target_lang}- Target language code{content}- The content to translate
Default prompt:
Translate and localize the following content from {source_lang} to {target_lang}.
Maintain the tone and style while adapting cultural references, idioms, and
expressions to be appropriate for the target audience. Preserve all HTML formatting.
Content to translate:
{content}
💡 Usage
From Post Editor
- Edit any post or custom post type
- Look for "Translate & Localize with Grok" metabox
- Select target language
- Click "Translate & Localize"
- Watch real-time progress
- Automatic redirect to translated post when complete
From Posts List
- Hover over any post in the admin list
- Click "Translate & Localize" in row actions
- Redirects to post editor with metabox ready
Translation Process
- Queued: Translation added to background queue
- Processing: Grok API processing the content
- Completed: Post updated with translated content
- Failed: Error message displayed (can retry)
🎯 How It Works
- Select content and target language
- Queue translation to avoid timeouts
- Background processing via WordPress cron
- Grok AI translates and localizes content
- Updates existing post with translated content
- Preserves post status and metadata
📊 Queue Management
The plugin processes translations in the background:
- Runs every minute via WordPress cron
- Processes in batches to avoid timeouts
- Automatic retry on failures
- Progress tracking in real-time
- Queue status visible in settings
🛡️ Timeout Prevention
Designed for servers with strict timeout limits:
- Background queue prevents Cloudflare 524 errors
- Configurable timeouts (30-300 seconds)
- Small batch sizes for reliability
- Chunked processing for large content
- Graceful failure handling
📋 Requirements
- WordPress 5.0+
- PHP 7.4+
- Polylang or Polylang Pro (required)
- Grok API key from xAI
- WordPress cron enabled
🔧 Troubleshooting
No translations processing
- Check WordPress cron is running
- Verify API key is correct
- Check queue status in settings
- Look for errors in WordPress debug log
Timeouts still occurring
- Reduce batch size to 1
- Lower request timeout
- Check server timeout settings
- Enable WordPress debug logging
Translations not appearing
- Check Polylang languages are configured
- Verify source post has language set
- Check if post content was actually updated
- Check queue for failed items
⚠️ Important Notes
- Updates existing posts - replaces content directly
- Preserves post status - published posts stay published
- Requires Polylang - won't work without it
- API costs apply - check xAI pricing
- Background processing - not instant
🐛 Known Limitations
- Only translates
post_contentfield - Updates posts directly without creating backups
- API rate limits may apply
- Depends on WordPress cron reliability
📞 Support
- GitHub Issues: Report bugs
- Created by: Winners Media Limited
🤝 Contributing
Contributions welcome! Help improve AI-powered WordPress translations:
- Fork the repository
- Create feature branch
- Make improvements
- Test thoroughly
- Submit pull request
📝 Changelog
Version 1.0.0
- Initial release
- Grok API integration
- Polylang compatibility
- Background queue processing
- Cloudflare timeout prevention
- Customizable prompts
- Progress tracking
📄 License
GPL v2 or later - same as WordPress
Transform your multilingual content workflow with AI-powered translation and localization!