Automatic translation management for WSForm with Polylang integration.
This plugin was entirely developed using AI (Cascade/Claude).
- ✅ Testing environment required: Only test on staging environments before production use
- ✅ Code review recommended: Code should be reviewed by a developer before production deployment
- ✅ Create backups: Always create a complete backup of your WordPress installation before installing
- ✅ Staging environment: Ideally test thoroughly on a staging environment first
Use at your own risk!
✅ Auto-Discovery - Automatic scanning of all form fields ✅ Complex Forms - Support for Repeater, Conditional Logic, Select options ✅ Centralized Management - Database-based translation management ✅ Polylang Integration - Seamless integration with Polylang ✅ Warning System - Automatic detection of missing translations ✅ Backend UI - Intuitive admin interface ✅ Performance - Caching system for optimal performance
- Upload plugin to
/wp-content/plugins/wsform-ml/ - Activate plugin in WordPress
- Ensure WS Form is installed
- Optional: Install Polylang for multi-language support
- Navigate to WSForm ML in WordPress Admin
- Select a form from the list
- Click "Scan Form"
- The system automatically detects all translatable fields
- Select a language from the tabs
- Expand fields to see properties
- Enter translations
- Click "Save"
The plugin automatically translates forms based on the current language:
- Uses
ws_form_pre_renderhook - Loads translations from database
- Applies translations before rendering
- Text, Email, Textarea
- Number, Tel, URL
- Hidden, Password
- Select, Radio, Checkbox - Including options
- Repeater - Nested fields
- HTML/Text Editor - Rich content
- Conditional Logic - Conditional texts
label- Field labelplaceholder- Placeholder texthelp- Help textinvalid_feedback- Error messageoptions- Select/Radio/Checkbox optionshtml- HTML contentaria_label- Accessibility
Stores all translations with:
- Form ID, Field ID, Field Path
- Property Type (label, placeholder, etc.)
- Language Code
- Original & Translated Value
- Sync Status
Cache for scanned fields:
- Field structure
- Translatable properties
- Repeater hierarchy
- Last scan time
Log of all scans:
- Found/New/Updated fields
- Scan duration
- Error logs
🔒 Security: All endpoints require manage_options capability (WordPress Admin only). Not accessible from outside.
GET /wp-json/wsform-ml/v1/forms
GET /wp-json/wsform-ml/v1/forms/{id}/fields
GET /wp-json/wsform-ml/v1/forms/{id}/translations
GET /wp-json/wsform-ml/v1/forms/{id}/translations/missing
GET /wp-json/wsform-ml/v1/forms/{id}/stats
POST /wp-json/wsform-ml/v1/forms/{id}/scan
POST /wp-json/wsform-ml/v1/translations
POST /wp-json/wsform-ml/v1/translations/bulk
DELETE /wp-json/wsform-ml/v1/translations/{id}
// After successful scan
do_action('wsform_ml_after_scan', $form_id, $stats);
// After saving a translation
do_action('wsform_ml_translation_saved', $translation_id, $data);// Customize translatable properties
apply_filters('wsform_ml_translatable_properties', $properties, $field);
// Customize translation map before rendering
apply_filters('wsform_ml_translation_map', $map, $form_id, $language);- Caching: Scanned fields are cached (5-minute transient cache for forms list)
- Auto-Save: Debounced auto-save (500ms) with visual indicators
- N+1 Query Fix: All translations loaded in single query
- Batch Operations: Bulk-save for multiple translations
- Optimized Queries: Indexed database queries
- Lazy Loading: Translations loaded only when needed
The plugin uses Polylang functions:
// Detect current language
pll_current_language()
// Default language
pll_default_language()
// Available languages
pll_languages_list()Also works without Polylang (fallback to English).
wsform-ml/
├── wsform-ml.php (Main Plugin)
├── includes/ (Core Classes)
│ ├── class-database.php
│ ├── class-field-scanner.php
│ ├── class-translation-manager.php
│ ├── class-renderer.php
│ └── class-polylang-integration.php
├── admin/ (Backend)
│ ├── class-admin-menu.php
│ ├── class-rest-api.php
│ ├── assets/
│ └── views/
└── languages/ (i18n)
add_filter('wsform_ml_translatable_properties', function($properties, $field) {
if ($field->type === 'custom_field') {
$properties[] = [
'type' => 'custom_property',
'path' => 'meta.custom_property',
'value' => $field->meta->custom_property
];
}
return $properties;
}, 10, 2);- WordPress 5.8+
- PHP 7.4+
- WS Form (any version)
- Optional: Polylang
For questions or issues:
- GitHub Issues
- WordPress Support Forum
GPL v2 or later
See CHANGELOG.md for full version history.
- Auto-Save with Debouncing (500ms)
- Transient Cache for Forms List (5 min)
- Plugin Internationalization (de_DE, en_US)
- Visual Save Indicators
- Performance Optimizations
- HTML Field Support
- Numeric Field Sorting
- Initial Release
- Auto-Discovery for all field types
- Polylang Integration
- Backend UI
- REST API
- Warning system for missing translations