Skip to content

42 · A multilingual site template is set up in its own language instead of the chosen one

Project Drupal CMS (installer)
Component Installer
Category Bug report
Priority Normal
Status Draft, not filed on drupal.org yet

Problem/Motivation

Since Drupal CMS 2.2.1 the installer looks at the languages of a site template's content. If the template ships content in more than one language and the language chosen at the start of the installer is not among them, the template's content language becomes the site's default language (SiteTemplate::getDefaultLangcode()). The chosen language is only added as an additional language at the end (drupal_cms_installer_add_chosen_language()).

Dashi ships its content in English and Spanish. Choosing "Deutsch" in the installer therefore gives an English site: the front page / is English, the German pages are under /de/ and have no content (/de returns 404, because the front page path /home only exists in English and Spanish). Only the administration is German, because user 1's preferred language is set to German.

Someone who chooses German expects a German site. With a single-language template that works: the content is imported in the chosen language and can be translated by modules such as Default Content Locale. With a multilingual template the installer decides against the chosen language before any such module can provide content in it.

Steps to reproduce

  1. Download Drupal CMS 2.2.1 and start the installer.
  2. Choose "Deutsch" and the Dashi site template.
  3. After the installation, open the front page: it is English. Settings → Regional settings shows English as the default language; /de returns "Page not found".

Proposed resolution

Use the chosen language as the site's default language and keep the template's languages as additional languages (keep_english already does this for English). If there is no content in the chosen language, the content can be imported in the template's language and translated, or shown in the template's language until it is translated.

At least, let other code tell the installer that a language will be provided: for example an extra.drupal_cms_installer.languages declaration that modules can alter, or an alter hook for the detected languages.

Workaround: the German installer dcgi patches SiteTemplate::getDefaultLangcode() so that a language counts as available if dcle ships a translation of the template (translations/TEMPLATE.LANGCODE.po, e.g. dashi.de.po). English and Spanish are kept, and German becomes the original language of the content.

Additional information

Found with Dashi 1.x (theme 1.0.0) on Drupal CMS 2.2.1, Drupal core 11.4.8 and Canvas 1.12.0 (October 2026). The swap of the original language during the import is the core issue #3622758, polyfilled by Drupal CMS Helper; this report is about the choice of the site's default language.

Copy to drupal.org

Issue title:

A multilingual site template is set up in its own language instead of the chosen one

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>Since Drupal CMS 2.2.1 the installer looks at the languages of a site template's content. If the template ships content in more than one language and the language chosen at the start of the installer is not among them, the template's content language becomes the site's default language (<code>SiteTemplate::getDefaultLangcode()</code>). The chosen language is only added as an additional language at the end (<code>drupal_cms_installer_add_chosen_language()</code>).</p>
<p>Dashi ships its content in English and Spanish. Choosing "Deutsch" in the installer therefore gives an English site: the front page <code>/</code> is English, the German pages are under <code>/de/</code> and have no content (<code>/de</code> returns 404, because the front page path <code>/home</code> only exists in English and Spanish). Only the administration is German, because user 1's preferred language is set to German.</p>
<p>Someone who chooses German expects a German site. With a single-language template that works: the content is imported in the chosen language and can be translated by modules such as <a href="https://www.drupal.org/project/default_content_locale">Default Content Locale</a>. With a multilingual template the installer decides against the chosen language before any such module can provide content in it.</p>
<h3 id="summary-steps-reproduce">Steps to reproduce</h3>
<ol>
<li>Download Drupal CMS 2.2.1 and start the installer.</li>
<li>Choose "Deutsch" and the Dashi site template.</li>
<li>After the installation, open the front page: it is English. Settings → Regional settings shows English as the default language; <code>/de</code> returns "Page not found".</li>
</ol>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Use the chosen language as the site's default language and keep the template's languages as additional languages (<code>keep_english</code> already does this for English). If there is no content in the chosen language, the content can be imported in the template's language and translated, or shown in the template's language until it is translated.</p>
<p>At least, let other code tell the installer that a language will be provided: for example an <code>extra.drupal_cms_installer.languages</code> declaration that modules can alter, or an alter hook for the detected languages.</p>
<p>Workaround: the German installer <a href="https://www.drupal.org/project/dcgi">dcgi</a> patches <code>SiteTemplate::getDefaultLangcode()</code> so that a language counts as available if <a href="https://www.drupal.org/project/dcle">dcle</a> ships a translation of the template (<code>translations/TEMPLATE.LANGCODE.po</code>, e.g. <code>dashi.de.po</code>). English and Spanish are kept, and German becomes the original language of the content.</p>
<h3>Additional information</h3>
<p>Found with Dashi 1.x (theme 1.0.0) on Drupal CMS 2.2.1, Drupal core 11.4.8 and Canvas 1.12.0 (October 2026). The swap of the original language during the import is the core issue <a href="https://www.drupal.org/i/3622758">#3622758</a>, polyfilled by Drupal CMS Helper; this report is about the choice of the site's default language.</p>