<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.6</td>
</tr>
</tbody>
</table>
<p dir="auto">I do not have symfony/templating installed.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1275206/29406077-424c3d96-8340-11e7-976c-565a946d3524.png"><img width="767" alt="screen shot 2017-08-17 at 11 35 58" src="https://user-images.githubusercontent.com/1275206/29406077-424c3d96-8340-11e7-976c-565a946d3524.png" style="max-width: 100%;"></a></p>
<p dir="auto">The first request is fine, but the second request causes an issue:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1275206/29406144-79a25c94-8340-11e7-9202-75558a8b21b0.png"><img width="1103" alt="screen shot 2017-08-17 at 11 37 13" src="https://user-images.githubusercontent.com/1275206/29406144-79a25c94-8340-11e7-9202-75558a8b21b0.png" style="max-width: 100%;"></a></p>
<p dir="auto">Possible solution: Make sure the</p>
<p dir="auto"><strong>Description</strong><br>
Unless I'm overlooking something, the internationalized routing as introduced in Symfony 4.1 has no fallback locale. We use 5 different locales within our application: nl_NL, nl_BE, en_GB, en_US and de_DE. We use a custom event listener to set the <code class="notranslate">_locale</code> value in the request. So we only use "full" locales, and not "nl", "en" etc.</p>
<p dir="auto">For the Translator component, nl_NL and nl_BE automatically fall back to <code class="notranslate">translations/messages.nl.yml</code> while en_GB and en_US fall back to <code class="notranslate">translations/messages.en.yml</code>. This allows us to avoid duplicate translations.</p>
<p dir="auto">The JMSI18nRoutingBundle has a similar approach as route translations are put in <code class="notranslate">translations/routes.en.yml</code> and <code class="notranslate">translations/routes.nl.yml</code>. As such we don't have to create duplicate translations files for en_GB and en_US.</p>
<p dir="auto">As we try to migrate JMSI18nRoutingBundle to Symfony internationalized routing, we would like to have a similar approach (i.e. avoid duplicate translations). Right now, we have to configure routes like this:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="news:
    controller: App\Controller\NewsController::item
    path:
        nl_BE: /nieuws
        nl_NL: /nieuws
        en_GB: /news
        en_US: /news
        de_DE: /nachrichten"><pre class="notranslate"><span class="pl-ent">news</span>:
    <span class="pl-ent">controller</span>: <span class="pl-s">App\Controller\NewsController::item</span>
    <span class="pl-ent">path</span>:
        <span class="pl-ent">nl_BE</span>: <span class="pl-s">/nieuws</span>
        <span class="pl-ent">nl_NL</span>: <span class="pl-s">/nieuws</span>
        <span class="pl-ent">en_GB</span>: <span class="pl-s">/news</span>
        <span class="pl-ent">en_US</span>: <span class="pl-s">/news</span>
        <span class="pl-ent">de_DE</span>: <span class="pl-s">/nachrichten</span></pre></div>
<p dir="auto">As you can see, that's a lot of duplication. It would be nice if the Routing component could look for fallback locales, similar like the Translation component and JMSI18nRoutingBundle. In the example below, nl_NL and nl_BE would also match the nl path.</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="news:
    controller: App\Controller\NewsController::item
    path:
        nl: /nieuws
        en: /news
        de: /nachrichten"><pre class="notranslate"><span class="pl-ent">news</span>:
    <span class="pl-ent">controller</span>: <span class="pl-s">App\Controller\NewsController::item</span>
    <span class="pl-ent">path</span>:
        <span class="pl-ent">nl</span>: <span class="pl-s">/nieuws</span>
        <span class="pl-ent">en</span>: <span class="pl-s">/news</span>
        <span class="pl-ent">de</span>: <span class="pl-s">/nachrichten</span></pre></div>