16 · Path aliases keep a hard-coded "en" langcode when content is imported in another language – front page 404¶
| Project | Drupal core (default content importer) – also Haven, Byte and other site templates |
| Component | default content / path |
| Category | Bug report |
| Priority | Major |
| Status | Draft, not filed on drupal.org yet |
Problem/Motivation¶
Default content exports aliases with an explicit language, e.g. path: [{alias: /home, langcode: en}]. The core importer imports the entity in the site language (Importer::verifyNormalizedLanguage()), but the alias keeps langcode: en. On a site without English, these aliases never match: the front page (/home) and other pages return 404.
Steps to reproduce¶
- Install Drupal CMS in German with Haven (English removed at the end of the installer).
- Visit
/→ 404;path_aliasshows/homewithlangcode = en.
Proposed resolution¶
When the importer changes the entity language, move the entity's aliases to the same language – or templates should export aliases without a fixed langcode.
Additional information¶
Workaround in dcle (AliasLanguageNormalizer, also applied before import so Pathauto patterns built from a parent alias work).
Copy to drupal.org
Issue title:
Path aliases keep a hard-coded "en" langcode when content is imported in another language – front page 404
Issue summary (paste it into the "Issue summary" field; project, component, category and priority are in the table above):
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Default content exports aliases with an explicit language, e.g. <code>path: [{alias: /home, langcode: en}]</code>. The core importer imports the entity in the site language (<code>Importer::verifyNormalizedLanguage()</code>), but the alias keeps <code>langcode: en</code>. On a site without English, these aliases never match: the front page (<code>/home</code>) and other pages return 404.</p>
<h3 id="summary-steps-reproduce">Steps to reproduce</h3>
<ol>
<li>Install Drupal CMS in German with Haven (English removed at the end of the installer).</li>
<li>Visit <code>/</code> → 404; <code>path_alias</code> shows <code>/home</code> with <code>langcode = en</code>.</li>
</ol>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>When the importer changes the entity language, move the entity's aliases to the same language – or templates should export aliases without a fixed <code>langcode</code>.</p>
<h3>Additional information</h3>
<p>Workaround in <code>dcle</code> (<code>AliasLanguageNormalizer</code>, also applied before import so Pathauto patterns built from a parent alias work).</p>