CMS Translation Plugin
The translation plugin adds translation actions to CMS content versions and, when installed, sections. Use it to prepare another language of an existing version or exchange translation files with a translator.
This is distinct from Symfony's UI message catalogs and the translation form field. A translated form field stores locale-specific data; this plugin provides workflows around that saved content.
Install and register
composer require softspring/cms-translation-plugin:6.0.x-dev
Register the bundle when Flex does not do it automatically:
// config/bundles.php
Softspring\CmsTranslationPlugin\SfsCmsTranslationPlugin::class => ['all' => true],
Configure languages and permissions
Enable the languages in Symfony and in the CMS site/content. A translation action cannot create a complete public language variant unless the corresponding site and route configuration also exist.
YAML
# config/packages/security.yaml
imports:
- { resource: '@SfsCmsTranslationPlugin/config/security/admin_role_hierarchy.yaml' }
security:
role_hierarchy:
ROLE_TRANSLATOR:
- ROLE_SFS_CMS_ADMIN_CONTENTS_TRANSLATOR
- ROLE_SFS_CMS_ADMIN_SECTIONS_TRANSLATOR
PHP
<?php
// config/packages/security.php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
return static function (ContainerConfigurator $container): void {
$container->import('@SfsCmsTranslationPlugin/config/security/admin_role_hierarchy.yaml');
$container->extension('security', [
'role_hierarchy' => [
'ROLE_TRANSLATOR' => ['ROLE_SFS_CMS_ADMIN_CONTENTS_TRANSLATOR', 'ROLE_SFS_CMS_ADMIN_SECTIONS_TRANSLATOR'],
],
]);
};
The host firewall must also admit the translator to the relevant admin area. Grant section capabilities only when the sections plugin is used. Translation permission does not automatically imply publication permission.
Translate a saved version
Open the content's translation action, choose the source version and target languages, review the translated values, and save through the provided form. Preview the resulting version in each language before publishing it.
The plugin extends content admin configuration with version_translations, version_translations_export, and version_translations_import. Each action exposes its own permission setting; form-based actions can also override their form class and Twig view.
Exchange XLIFF files
Export the intended target language, send the file through the project's translation process, then import the completed file into the compatible content/version workflow. The supported configured format is xliff12.
Retain the identifiers and structure generated by the exporter. Check the imported target text, module context, links, and layout before publication. An XLIFF import is not an application deployment and cannot add missing module definitions.
Enable machine translation separately
The optional config/routing/api_translate.yaml resource delegates to Translatable Bundle's API. That API needs its own provider configuration and application access rules. See Translatable Bundle; installing this plugin alone does not configure a translation provider or credentials.
Use translated module fields when a new custom module needs values in several languages.