<p dir="auto"><strong>Symfony version(s) affected</strong>: Probably all of them, but I am currently in 4.1</p>
<p dir="auto"><strong>Description</strong></p>
<p dir="auto">When you try to put the Translator Path in an envrionment variable, Symfony try to check if the Path exist <strong>BEFORE</strong> the compilation of the envrionment variable.</p>
<p dir="auto">So with <code class="notranslate">'%env(resolve:PATH_TRANSLATION)%'</code>, Symfony throw an UnexpectedValueException : <code class="notranslate">%env(resolve:PATH_TRANSLATION)% defined in translator.paths does not exist or is not a directory</code>.</p>
<p dir="auto"><strong>How to reproduce</strong></p>
<p dir="auto">You can reproduce the bug easily by adding an environment variable (in <code class="notranslate">.env</code>) and resolve it in the config file.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="framework:
    translator:
        paths:
            - '%env(resolve:PATH_TRANSLATION)%'"><pre class="notranslate"><code class="notranslate">framework:
    translator:
        paths:
            - '%env(resolve:PATH_TRANSLATION)%'
</code></pre></div>
<p dir="auto"><strong>Possible Solution</strong></p>
<p dir="auto">Symfony should resolve the environment variable before checking if the file exist or not.</p>
<p dir="auto"><strong>Additional context</strong></p>
<p dir="auto">Symfony bump into here ==&gt; <a href="https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L1020">https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L1020</a></p>
<table role="table">
<thead>
<tr>
<th>Q</th>
<th>A</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bug report?</td>
<td>yes</td>
</tr>
<tr>
<td>Feature request?</td>
<td>no</td>
</tr>
<tr>
<td>BC Break report?</td>
<td>no</td>
</tr>
<tr>
<td>RFC?</td>
<td>no</td>
</tr>
<tr>
<td>Symfony version</td>
<td>3.3.9</td>
</tr>
</tbody>
</table>
<p dir="auto">when using an env var inside the value of a framework.translator.paths, the env var value is not resolved, and instead its placeholder is given to the translator</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="parameters:
  active_site: '%env(ACTIVE_SITE)%'

framework:
    translator:
        paths:
            - &quot;%kernel.root_dir%/../src/ST/AppBundle/Resources/translations_sites/%active_site%&quot;"><pre class="notranslate"><span class="pl-ent">parameters</span>:
  <span class="pl-ent">active_site</span>: <span class="pl-s"><span class="pl-pds">'</span>%env(ACTIVE_SITE)%<span class="pl-pds">'</span></span>

<span class="pl-ent">framework</span>:
    <span class="pl-ent">translator</span>:
        <span class="pl-ent">paths</span>:
            - <span class="pl-s"><span class="pl-pds">"</span>%kernel.root_dir%/../src/ST/AppBundle/Resources/translations_sites/%active_site%<span class="pl-pds">"</span></span></pre></div>
<blockquote>
<p dir="auto">UnexpectedValueException<br>
/var/www/app/../src/ST/AppBundle/Resources/translations_sites/env_ACTIVE_SITE_1210a6ec49918eebfffc01fc4f72ca65 defined in translator.paths does not exist or is not a directory</p>
</blockquote>
<p dir="auto">note: same thing happen if I use the env directly like that:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="framework:
    translator:
        paths:
            - &quot;%kernel.root_dir%/../src/ST/AppBundle/Resources/translations_sites/%env(ACTIVE_SITE)%&quot;"><pre class="notranslate"><span class="pl-ent">framework</span>:
    <span class="pl-ent">translator</span>:
        <span class="pl-ent">paths</span>:
            - <span class="pl-s"><span class="pl-pds">"</span>%kernel.root_dir%/../src/ST/AppBundle/Resources/translations_sites/%env(ACTIVE_SITE)%<span class="pl-pds">"</span></span></pre></div>