- How do I install alengo/sulu-translated-media-bundle in a Sulu 3.x project?
- Run composer require alengo/sulu-translated-media-bundle, then register TranslatedMediaBundle::class => ['all' => true] in config/bundles.php. Import the bundle's routing_admin_api.yaml in config/routes/sulu_admin.yaml under the /admin/api prefix. Finally create the me_media_translations table with doctrine:schema:update or a Doctrine migration. No further configuration is needed, because sulu_media.objects.media.model and the sulu_admin resources are registered automatically.
- Which PHP, Sulu, and Symfony versions does this bundle support?
- The documented baseline is PHP 8.2+, Sulu CMS ~3.0, and Symfony 7.x. Release 3.2.0 adds a second track targeting Sulu 3.1 with Symfony 8.1, and Symfony 8 requires PHP 8.4 or newer. Teams on PHP 8.2 or 8.3 must stay on the Symfony 7 track or upgrade PHP first, since that upgrade is a prerequisite rather than a follow-up task.
- How does SuluTranslatedMediaBundle generate locale-specific SEO filenames?
- Each media item stores a per-locale seoFilename, title, and description in the me_media_translations table. The bundle replaces Sulu's default FormatManager with TranslatedFormatManager through a compiler pass, so files are served under names like /uploads/red-shoes-de.jpg while the original upload keeps its original name on disk. Those translations are edited from an Additional Data tab inside the Sulu Media admin.
- How do I render translated media URLs in Twig, including WebP?
- Use sulu_translated_media_url(media, '800x', app.request.locale) for a single URL, and pass a fourth argument to force a format such as webp. For responsive markup, sulu_translated_media_urls(media, '800x', app.request.locale) returns an array with default and webp keys that drop straight into picture and srcset markup. Both helpers fall back to Sulu's standard media URL behavior when no translation exists for the requested locale.
- Do I need to configure anything after installing the bundle?
- No, the bundle is zero-config. It auto-registers sulu_media.objects.media.model and the sulu_admin resources, and it ships a ready-to-use Media entity extending Sulu's base class. The only mandatory steps are bundle registration, the admin route import, and the schema update for me_media_translations. You can still extend the provided entity if your project needs additional fields.
- How do I create the me_media_translations table and migrate safely?
- The table can be created with doctrine:schema:update --force or a regular Doctrine migration. On newer Doctrine and Symfony stacks, review the generated schema diff before applying it rather than running --force blindly, because unrelated diffs can appear. This bundle's schema was not reported as changed in 3.2.0, but verifying the diff costs little. Also confirm the locale index exists on the table before ramping traffic.
- Is upgrading from 3.0.x to 3.2.0 a breaking change?
- A minor-version bump implies no intentional breaking changes, and the FormatManager compiler-pass replacement plus the sulu_media_url fallback should still hold. However, the 3.1.x release notes were not supplied with the jump to 3.2.0, so inherited behavioral changes cannot be ruled out from version numbers alone. Test against a staging build before production, and pin to ^3.2 deliberately so each environment records which support track it rides.
- Can I use this bundle on Symfony 8.1 and Sulu 3.1?
- Yes, release 3.2.0 explicitly targets Sulu 3.1 and Symfony 8.1, but that track requires PHP 8.4 or newer. Adopting it pulls Doctrine ORM, Twig, and every Sulu-adjacent bundle onto the Symfony 8 line, and third-party media bundles or storage adapters such as S3 and image processors are the usual blockers. Re-validate the format cache key structure and the admin routing, including the /admin/api prefix, on the 3.1 stack before committing.
- What is the performance impact of translated media URLs?
- Rendering a translated media item costs one or more lookups against me_media_translations, so the profile scales with the number of media items on a page. Confirm the locale index is present on that table before traffic ramps. The bundle also ships format cache warming, which pre-generates jpg, webp, and avif derivatives at x1 and x2 under the translated filenames so first requests do not pay the generation cost.
- Is this a good alternative to hand-rolled SEO media filenames, and is it still maintained?
- It is the practical option on Sulu CMS 3.x if you want locale-specific filenames without building your own FormatManager replacement, cache warming, and admin tab. Shipping Sulu 3.1 support promptly signals the vendor is tracking the CMS release train, which lowers the abandoned-dependency risk compared with lagging forks. Note that it is a Sulu and Symfony bundle, not a Laravel package, so it does not apply to Laravel applications.