Skip to content

Commit

Permalink
Fix changing dump directory using AssetMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
maelanleborgne committed Jun 10, 2024
1 parent 7a84975 commit a27cfc8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/Translator/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ file. 2 of the new items are::
'path' => 'var/translations/configuration.js',
],

.. caution::

If you change the ``dump_directory`` in your configuration file, you will need to
replace the default ``var/translations/***`` with your new path in the
``importmap.php`` file.

These are then imported in your ``assets/translator.js`` file. This setup is
very similar to working with WebpackEncore. However, the ``var/translations/index.js``
file contains *every* translation in your app, which is not ideal for production
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ public function prepend(ContainerBuilder $container)
if (!$this->isAssetMapperAvailable($container)) {
return;
}

$config = $container->getExtensionConfig('ux_translator')[0];
$container->prependExtensionConfig('framework', [
'asset_mapper' => [
'paths' => [
__DIR__.'/../../assets/dist' => '@symfony/ux-translator',
'%kernel.project_dir%/var/translations' => 'var/translations',
$config['dump_directory'] => '@app/translations',
],
],
]);
Expand Down

0 comments on commit a27cfc8

Please sign in to comment.