A comprehensive WordPress plugin for managing multilingual content translation workflows with AI-powered translation support and advanced workflow automation.
- Full Documentation Index - Complete documentation structure
- Quick Start Guide - Get started in 5 minutes
- Changelog - Version history and changes
- Features
- Architecture
- Installation
- Configuration
- Usage
- Recent Improvements
- REST API Endpoints
- Hooks and Filters
- Security Considerations
- Testing
- Troubleshooting
- Development
- Requirements
- License
- Translation Meta Box: Mark posts as human or machine translated
- Translation Scheduler: Schedule automatic translations to multiple languages
- Translation Status Tracking: Monitor translation progress and logs
- Review Workflow: Assign reviewers for translation quality control
The plugin uses a hot-pluggable provider architecture that supports:
- Google Translate: Simple, fast machine translation using public API (no API key required)
- OpenAI Integration: AI-powered translation with custom assistants
- API key configuration required
- Custom assistant mapping per language pair
- Multi-step translation support for complex language workflows
Advanced workflow automation system for translated content:
- AI-Powered Processing: Custom AI assistants for content enhancement
- Multi-Step Workflows: Chain processing steps for complex transformations
- Output Actions: Automatically update post content, titles, meta, status, and scheduling
- Test Mode: Preview workflow changes before applying them
- Comprehensive Logging: Full audit trail of all workflow executions
- Workflow Attribution: Assign specific users to be credited for workflow changes
- Post Creation Attribution: Preserve original author attribution for translated posts
- Clean Revision Logs: Maintain proper authorship in WordPress revision history
- Audit Trail: Complete logging of all user context switches and changes
- Modular Receiver System: Specialized manager classes for different aspects of translation processing
- Translation Coordinator: Orchestrates the entire translation process
- Request Validation: Comprehensive validation of incoming translation requests
- Post Creation: Robust post creation with proper sanitization and author attribution
- Metadata Management: Intelligent copying and translation of post metadata
- Taxonomy Management: Automatic category and tag translation mapping
- Language Management: Polylang integration with translation relationships
- Security: IP restrictions and authentication validation
- REST API Endpoints: Receive translated content from external services
- Email Notifications: Notify reviewers and authors throughout the workflow
- User Assignment: Autocomplete user search for reviewer assignment
- Tag Translation Management: Manage multilingual taxonomy translations
- Polylang Integration: Full compatibility with Polylang plugin
- Flexible Language Configuration: Configure allowed source and target languages
- Status Management: Set post status after translation (publish, draft, pending, same as source)
The plugin supports both single-server and multi-server translation workflows:
- Single Server (Local): All translation processing happens on the same WordPress installation
- Multi-Server: Translation work can be distributed across multiple WordPress installations
- Scheduler Server: Manages translation requests
- Translator Server: Performs actual translation work
- Receiver Server: Processes completed translations
The plugin implements a hot-pluggable provider architecture:
- Translation Provider Interface: Defines core translation functionality
- Settings Provider Interface: Handles provider-specific configuration UI
- Provider Registry: Automatic discovery and registration of translation providers
- Dynamic Settings UI: Providers automatically appear in settings with their own configuration tabs
Advanced post-processing workflow engine:
- Step Registry: Pluggable step types for different processing tasks
- Context Management: Proper data flow between workflow steps
- Output Processing: Automated post updates based on workflow results
- Attribution Management: User context switching for proper change attribution
- WordPress: 5.0 or higher
- PHP: 8.1 or higher
- Composer: Required for dependency management (Twig, PSR-4 autoloading)
- Download the latest release (includes
vendor/directory) - Upload the plugin files to
/wp-content/plugins/polytrans/ - Activate the plugin through the 'Plugins' menu in WordPress
- Configure settings under PolyTrans > Settings
- Clone the repository to
/wp-content/plugins/polytrans/ - Install Composer dependencies (required):
cd /wp-content/plugins/polytrans/ composer install - Activate the plugin through the 'Plugins' menu in WordPress
- Configure settings under PolyTrans > Settings
vendor/autoload.php) to function. If you see errors on activation, make sure you've run composer install.
- Go to Settings > Translation Settings
- Choose your translation provider (Google Translate or OpenAI)
- Configure allowed source and target languages
- Set up post status and reviewer settings for each language
- No setup required - Google Translate works out of the box using the public API
- Simply select "Google Translate" as your provider
- Select "OpenAI" as translation provider
- Enter your OpenAI API key
- Choose your primary OpenAI language
- Map assistants to language pairs (e.g., "en_to_pl" → "asst_123")
- Test your configuration using the built-in testing interface
- Navigate to PolyTrans > Workflows in WordPress admin
- Create new workflows or edit existing ones
- Configure workflow steps:
- AI Assistant Steps: Use OpenAI for content processing
- Predefined Assistant Steps: Use pre-configured prompts
- Output Actions: Define what should be updated (content, status, scheduling, etc.) (title, content, meta, status, date, etc.)
- Set up triggers for when workflows should run
- Configure user attribution if needed
- Configure translation endpoint URLs for external translation services
- Set up receiver endpoint for incoming translated content
- Configure authentication secrets and methods
- Customize email templates for notifications
- Edit any post or page
- Use the "Translation" meta box to mark translation type
- Use the "Translation Scheduler" meta box to:
- Select translation scope (Local, Regional, Global)
- Choose target languages for Regional scope
- Enable review if needed
- Click "Translate"
- Go to PolyTrans > Workflows
- Create or edit workflows:
- Name and Description: Basic workflow information
- Steps: Configure AI processing steps
- Output Actions: Define what should be updated
- Triggers: Set when workflow should run
- Attribution User: Optionally assign changes to specific user
- Test workflows before enabling them
- Monitor workflow execution through logs
- Go to Posts > Tag Translations
- Add tags to translate in the tag list
- Map translations for each language
- Export/import CSV for bulk management
- Reviewers receive email notifications when translations are ready
- Edit the translated post to review content
- Publish or update status as needed
- Original author receives notification when published
- Feature: New field in workflow settings to specify attribution user
- Implementation: User autocomplete field with backend validation
- Benefits: Clean revision logs, proper change attribution
- Files Modified:
includes/Menu/PostprocessingMenu.php(PSR-4:PolyTrans\Menu\PostprocessingMenu)includes/PostProcessing/WorkflowOutputProcessor.php(PSR-4:PolyTrans\PostProcessing\WorkflowOutputProcessor)assets/js/postprocessing-admin.jsassets/js/core/user-autocomplete.js
- Issue: Translated posts were attributed to system user instead of original author
- Root Cause:
post_authorfield was not included in post creation array - Solution: Modified
PolyTrans_Translation_Post_Creator::create_post()to include original author - Benefits: Proper author attribution from post creation, cleaner revision history
- Files Modified:
includes/Receiver/Managers/PostCreator.php(PSR-4:PolyTrans\Receiver\Managers\PostCreator)includes/Receiver/Managers/MetadataManager.php(PSR-4:PolyTrans\Receiver\Managers\MetadataManager)
- Issue: Subsequent workflow steps received stale data instead of updated values
- Root Cause: Execution context only updated in test mode, not production mode
- Solution: Updated context in both test and production modes, added database refresh
- Benefits: Proper data flow between workflow steps, correct step execution
- Files Modified:
includes/PostProcessing/WorkflowExecutor.php(PSR-4:PolyTrans\PostProcessing\WorkflowExecutor)includes/PostProcessing/WorkflowOutputProcessor.php(PSR-4:PolyTrans\PostProcessing\WorkflowOutputProcessor)
- Issue: "Actions processed: 0" consistently shown in logs
- Root Cause: Data type mismatch between workflow executor and output processor
- Solution: Fixed executor to treat
processed_actionsas integer, not array - Benefits: Accurate action counting, better debugging capability
- Files Modified:
includes/PostProcessing/WorkflowExecutor.php(PSR-4:PolyTrans\PostProcessing\WorkflowExecutor)
- Consolidated Logging: Unified logging system across all components
- Better Validation: Enhanced input validation and error handling
- Test Mode: Comprehensive test mode for workflow validation
- Debug Support: Extensive debugging tools and logging
- Feature: AI workflows can now automatically set post status based on content analysis
- Supported Actions:
update_post_statusoutput action with intelligent status parsing - AI Response Formats: Handles various status formats (published→publish, draft, pending review→pending, etc.)
- Validation: Validates against WordPress post status system with helpful error messages
- Benefits: Automated content quality gates, intelligent publishing workflows
- Feature: AI workflows can schedule posts for optimal publishing times
- Supported Actions:
update_post_dateoutput action with flexible date parsing - Date Formats: Supports MySQL, ISO, US/European formats, and natural language (tomorrow, next week)
- WordPress Integration: Automatically sets both
post_dateandpost_date_gmtfields - Benefits: AI-driven optimal timing, automated content scheduling
- Quality Gates: AI determines if translated content meets quality standards before publishing
- Optimal Timing: AI analyzes content and suggests best publish times based on audience and content type
- Editorial Workflow: AI routes content through different review stages (draft→pending→publish)
- Seasonal Content: AI schedules content based on relevance and timing analysis
- Files Modified:
includes/PostProcessing/WorkflowOutputProcessor.php(PSR-4:PolyTrans\PostProcessing\WorkflowOutputProcessor) - New Methods:
update_post_status(),update_post_date(),parse_post_status(),parse_post_date() - Error Handling: Comprehensive validation with helpful error messages and format examples
- Logging: Full audit trail of all status and date changes with original AI responses
- POST
/wp-json/polytrans/v1/translation/translate- Receive and process translation requests - POST
/wp-json/polytrans/v1/translation/receive-post- Receive completed translations
- POST
/wp-json/polytrans/v1/workflows/test- Test workflow execution - POST
/wp-json/polytrans/v1/workflows/execute- Execute workflow
All endpoints support configurable authentication:
- Bearer token in Authorization header
- Custom header (x-polytrans-secret)
- POST parameter
polytrans_translation_before_create- Before creating translated postpolytrans_translation_after_create- After creating translated postpolytrans_translation_status_updated- When translation status changespolytrans_workflow_before_execute- Before workflow executionpolytrans_workflow_after_execute- After workflow execution
polytrans_register_providers- Register custom translation providerspolytrans_translation_allowed_meta_keys- Modify allowed meta keys for translationpolytrans_translation_post_data- Modify post data before creating translationpolytrans_translation_email_content- Customize notification email contentpolytrans_workflow_context- Modify workflow execution contextpolytrans_workflow_steps- Register custom workflow step types
📋 Complete Documentation Index - Find all documentation organized by audience and topic
- 📦 Installation Guide - Get PolyTrans installed
- ⚡ Quick Start Tutorial - First translation in 5 minutes
- 🖥️ User Interface Guide - Learn the admin interface
- ❓ FAQ & Troubleshooting - Common questions and solutions
- 🔧 Configuration Guide - Complete setup reference
- 🔄 Workflow Management - Automate post-processing
- 📝 Workflow Logging - Monitor system activity
- 📖 Plain Text Workflow Guide - Advanced workflows
- ⚡ Performance Tuning - Optimize for your environment
- 🔒 Security Settings - Secure your translation setup
- 📡 API Documentation - REST API reference
- 🏗️ Architecture Overview - System design and structure
- 💻 Development Setup - Local dev environment
- 🤝 Contributing Guidelines - How to contribute
- 🔌 Plugin Hooks & Filters - WordPress integration
- 📊 Code Quality Status - Development status
- 📝 Changelog - Version history and changes
- ⚙️ Task Queue System - Background processing
- 📊 Workflow Logging - System monitoring
- 📈 Implementation Status - Current system status
- 📝 Blog Post Translation - Complete blog translation workflow
- 🛒 E-commerce Translation - Product catalog translation
- 🎯 Landing Page Translation - Marketing content translation
- ⚙️ SEO Workflow Example - Live workflow code
- User context switching only occurs during actual execution (not test mode)
- Original user context is always restored after workflow completion
- Comprehensive logging of all user context changes
- Validation of attribution user existence and permissions
- All AJAX endpoints require proper nonce verification
- User permission validation on all administrative functions
- Secure user search with capability restrictions
- Configurable authentication methods for REST endpoints
- IP-based access restrictions
- Request validation and sanitization
All test files are located in /tests/ directory:
test-attribution-user.php- User attribution featurestest-post-attribution.php- Post creation attributiontest-context-updating.php- Workflow context updatingtest-actions-count.php- Action counting validationtest-workflow-output.php- Workflow execution testing- And more...
Tests can be run individually by accessing them through WordPress admin or web interface:
http://yoursite.com/wp-content/plugins/polytrans/tests/test-attribution-user.php
- Workflow execution and output processing
- User attribution and context switching
- Post creation and metadata management
- Context updating between workflow steps
- Action counting and logging
- Status: ✅ Fixed in latest version
- Cause: Data type mismatch between components
- Solution: Upgrade to latest version for automatic fix
- Status: ✅ Fixed in latest version
- Cause: Context only updated in test mode
- Solution: Upgrade to latest version for automatic fix
- Check: Ensure attribution user exists and has valid permissions
- Check: Verify workflow configuration includes attribution user
- Check: Review logs for user context switching messages
- Status: ✅ Fixed in latest version
- Cause: Missing
post_authorfield in post creation - Solution: Upgrade to latest version for automatic fix
Enable debug logging by adding to wp-config.php:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);Check logs at /wp-content/debug.log for detailed execution information.
- WordPress Debug Log:
/wp-content/debug.log - PolyTrans Logs: Database table
polytrans_logs - Workflow Logs: Accessible through admin interface
- Clone the repository
- Install dependencies (if applicable)
- Enable debug mode for development
- Run tests to validate functionality
polytrans/
├── assets/ # CSS, JS, and other assets
├── includes/ # PHP classes and core functionality
│ ├── menu/ # Admin menu management
│ ├── postprocessing/ # Workflow system
│ ├── receiver/ # Translation processing
│ └── ...
├── tests/ # Test files
└── README.md # This file
- Follow WordPress coding standards
- Add comprehensive tests for new features
- Update documentation for any new functionality
- Ensure all tests pass before submitting changes
- WordPress: 5.0 or higher
- PHP: 7.4 or higher
- Database: MySQL 5.7+ or MariaDB 10.1+
- JSON Extension: Required for API communication and data processing
- cURL Extension: Required for external API calls (OpenAI, Google Translate, external translation services)
- mbstring Extension: Required for proper Unicode/UTF-8 string handling in multilingual content
- OpenSSL Extension: Required for secure HTTPS communication with external APIs
- REST API: Plugin uses WordPress REST API extensively
- AJAX: Required for admin interface interactions
- Cron/WP-Cron: Required for background processing (can be disabled in favor of external cron)
- Post Revisions: Required for proper attribution tracking
- User Capabilities: Requires
edit_posts,manage_options, and other standard WordPress capabilities
- None - The plugin works standalone
- Polylang: For full multilingual support and automatic language detection
- Version: 3.0 or higher recommended
- Provides: Language detection, post language assignments, taxonomy translations
- Without Polylang: Plugin falls back to default languages (Polish, English, Italian)
- Functionalities that break without Polylang:
- ❌ Automatic language detection: Cannot detect post language automatically
- ❌ Post language assignment: New translated posts won't be assigned proper language
- ❌ Translation relationships: Posts won't be linked as translations of each other
- ❌ Context article filtering: Recent articles won't be filtered by target language
- ❌ Tag translation management: Cannot properly manage multilingual taxonomy translations
- ❌ Language-specific content queries: Falls back to hardcoded language list
⚠️ Limited language support: Only supports Polish, English, Italian (hardcoded)
-
Yoast SEO: For SEO metadata translation support
- With Yoast SEO:
- ✅ SEO metadata translation: Yoast SEO fields are included in translation payload and translated
- ✅ Supported Yoast SEO fields (included in translation):
_yoast_wpseo_title_yoast_wpseo_metadesc_yoast_wpseo_focuskw_yoast_wpseo_opengraph-title_yoast_wpseo_opengraph-description_yoast_wpseo_twitter-title_yoast_wpseo_twitter-description
- ✅ SEO context in workflows: Yoast SEO data available in post processing workflows
- ✅ Search functionality: Post search includes Yoast SEO fields
- Without Yoast SEO:
- ❌ No SEO metadata: Yoast-specific fields won't be present or translated
- ❌ SEO context missing: No Yoast data in workflows or search
- ℹ️ Core functionality intact: Basic translation still works
- With Yoast SEO:
-
RankMath: For SEO metadata translation support
- With RankMath:
- ✅ SEO metadata translation: RankMath fields are included in translation payload and translated
- ✅ Supported RankMath fields (included in translation):
rank_math_titlerank_math_descriptionrank_math_facebook_titlerank_math_facebook_descriptionrank_math_twitter_titlerank_math_twitter_descriptionrank_math_focus_keyword
- ✅ SEO context in workflows: RankMath data available in post processing workflows
- ✅ Search functionality: Post search includes RankMath SEO fields
- Without RankMath:
- ❌ No SEO metadata: RankMath-specific fields won't be present or translated
- ❌ SEO context missing: No RankMath data in workflows or search
- ℹ️ Core functionality intact: Basic translation still works
- With RankMath:
- OpenAI API Key: Required for AI-powered translation
- OpenAI API Access: Requires active OpenAI account with API credits
- Internet Connection: Required for API communication
- HTTPS: Required for secure API communication
- No API Key Required: Uses public Google Translate API
- Internet Connection: Required for translation requests
- HTTPS: Required for secure communication
- Apache 2.4+ or Nginx 1.18+
- HTTPS Support: Recommended for secure API communication
- URL Rewriting: Required for WordPress permalinks
- PHP Memory Limit: 256MB minimum, 512MB recommended
- PHP Execution Time: 300 seconds recommended for translation processing
- PHP Max Input Vars: 3000+ recommended for complex workflows
- WordPress uploads directory: Must be writable for temporary files
- Plugin directory: Must be readable by web server
- Outbound HTTPS: Required for external API calls
- Inbound HTTPS: Required for receiving webhook translations
- Firewall: May need configuration for webhook endpoints
- PHPUnit: 9.0+ for running tests
- Composer: For dependency management
- PHP_CodeSniffer: For code quality checks
- PHPMD: For code analysis
- Chrome: 90+
- Firefox: 88+
- Safari: 14+
- Edge: 90+
- JavaScript: Must be enabled for admin interface
- Background Processing: Plugin can use WordPress cron or external cron for better performance
- Database: Regular optimization recommended for large translation volumes
- Caching: Compatible with most WordPress caching plugins
- SSL/TLS: Required for production environments
- API Key Security: Store API keys securely (not in version control)
- User Permissions: Proper WordPress user role management
- Input Validation: All inputs are sanitized and validated
- WordPress Multisite: Not tested/supported
- PHP 8.0+: Fully compatible
- WordPress 6.0+: Fully compatible
- Classic Editor: Compatible
- Gutenberg/Block Editor: Compatible
This plugin is proprietary software developed for the PolyTrans platform.
For support and documentation updates, please contact the development team.
Last updated: December 2024