v1.4.0 — Event Dispatching & Locale Validation
What's Changed
- Added:
PRE_TRANSLATEandPOST_TRANSLATEevents withTranslateEventfor flexible extension points - Added: Locale configuration validation with clear error handling for unsupported locales
- Added: Attribute-based configuration for listeners:
#[AsEventListener(event: KernelEvents::REQUEST, method: 'onKernelRequest', priority: 2)]inLocaleFilterConfigurator#[AsDoctrineListener(event: Events::prePersist)]#[AsDoctrineListener(event: Events::postLoad)]#[AsDoctrineListener(event: Events::onFlush)]inTranslatableEventSubscriber
- Improved: Translation process with better lifecycle hooks and attribute handling
- Prepared: ToDo for introducing a dedicated
TranslationCacheService(see Issue #3)
Why It Matters
This release expands the translation system with proper event dispatching, making it easier for developers to hook into the translation lifecycle.
It also strengthens locale handling by enforcing configuration checks, ensuring invalid locales never slip through.
- Flexibility: Developers can now listen to translation lifecycle events (
PRE_TRANSLATE,POST_TRANSLATE) - Consistency: Locale validation ensures only supported locales are used
- Modernization: Doctrine and Symfony events are now configured via PHP attributes and service YAML for reliability
- Maintainability: Clear ToDos for caching refactor and stricter attribute handling
Full Changelog: v1.3.1...v1.4.0