This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is the Smartling Connector WordPress plugin - a translation and localization platform integration that seamlessly translates WordPress content through the Smartling API. The plugin handles content upload, translation management, and automatic download of completed translations.
- Unit tests:
./inc/third-party/phpunit/phpunit/phpunit --testsuite "smartling-connector WordPress plugin test" --bootstrap ./tests/IntegrationTests/includes/bootstrap_units.php --configuration ./tests/phpunit.xml
- Build plugin:
./build.sh- Creates production-readysmartling-connector.zip - Composer dependencies:
./composer update(dev),./composer update --no-dev(production)
- Dependencies are installed to
inc/third-party/(configured in composer.json) - Scoped namespacing prevents conflicts with other WordPress plugins, installed to
inc/lib/(https://github.com/vsolovei-smartling/namespacer)
Bootstrap Process (inc/Smartling/Bootstrap.php):
- Main entry point that initializes the plugin
- Handles dependency injection container setup
- Registers WordPress hooks and services
- Manages plugin activation/deactivation
Content Management:
ContentTypes/- Handles different WordPress content types (posts, pages, taxonomies, menus, widgets)ExternalContent*- Specialized handlers for third-party plugins (Elementor, Yoast, ACF, Gravity Forms, Beaver Builder)Submissions/- Core translation workflow management
Translation Pipeline:
- Upload: Content serialization → Smartling API upload
- Processing: Translation occurs in Smartling dashboard
- Download: Completed translations → WordPress content application
Key Services:
ApiWrapper- Smartling API communication layer with retry logicSubmissionManager- Translation job lifecycle managementContentHelper- WordPress content serialization/deserializationFieldsFilterHelper- Field filtering and transformation rules
DbAl/- Database abstraction layerMigrations/- Schema versioning and updatesWordpressContentEntities/- WordPress-specific entity handling
Extensions/- Plugin extension system for third-party integrationsTuner/- Content filtering and rule managementReplacers/- Content transformation during translation
Unit Tests (tests/):
- Test individual components in isolation
- Mock dependencies for fast execution
- Run with:
./inc/third-party/phpunit/phpunit/phpunit --configuration ./phpunit.xml.dist
Integration Tests (tests/IntegrationTests/):
- Full WordPress environment testing
- Real database operations
- Third-party plugin compatibility testing
- Run with:
phpunit -c tests/phpunit.xml
Docker Testing:
- Complete isolated environment with MySQL
- Automated via
Buildplan/test.sh - Includes WordPress multisite configuration
Service Configuration (inc/config/):
services.yml- Dependency injection container setupboot.yml- Bootstrap configurationfield-processor.yml- Content processing rulesmedia-attachment-rules.yml- Media handling rules
Key Settings:
- Content type auto-discovery
- Field filtering rules
- Translation workflow configuration
- Third-party plugin integration settings
- PSR-0 autoloading with
Smartling\namespace - Dependency injection throughout the codebase
- Extensive use of interfaces for testability
- WordPress hooks for extensibility
- All content goes through serialization/deserialization pipeline
- Field-level filtering for translation control
- Relationship tracking between original and translated content
- Gutenberg block-level translation support
- Robust error handling and retry mechanisms
- Job-based translation workflow
- Progress tracking and status reporting
- Webhook support for real-time updates
- Modular extension system for popular WordPress plugins
- Page builder support (Elementor, Beaver Builder)
- SEO plugin integration (Yoast, All in One SEO)
- Form plugin support (Gravity Forms)
- Advanced Custom Fields (ACF) support
When working on content type support, examine existing ContentTypes/ implementations. For API changes, check both ApiWrapper and related tests. For field processing modifications, review FieldsFilterHelper and corresponding configuration files.
When adding or modifying Elementor widget support, refer to the comprehensive guide:
- Elementor Development Guide:
docs/ELEMENTOR_DEVELOPMENT.md - Contains patterns for processing related content, testing strategies, and real-world examples
- Essential reading for WP-* tickets involving Elementor widgets