46 · Interface texts of the theme and the premium calculator are hard-coded in English¶
| Project | Goodwell (theme goodwell_theme, used by the Goodwell site template) |
| Component | Code |
| Category | Bug report |
| Priority | Normal |
| Status | Draft, not filed on drupal.org yet |
Problem/Motivation¶
The Goodwell theme writes its own interface texts directly into the Twig templates and into JavaScript, without t(). On a site in another language they stay English, and no translation can reach them. Visible on the front page of the template:
- Premium calculator: "I am", "Male", "Female", "My Age", "years", "I want cover of", "Cover amount in lakhs", "Estimated monthly premium", "Indicative only, subject to underwriting", "My age in years", and the result " / month", which
premium-calculator.jsappends in JavaScript. - Testimonial slider: "Testimonials", "Slide navigation" and the screen reader labels "1 of 3" and "Go to slide 1", built from the loop index.
- Further texts: "Read More", "Question", "Industry awards", and the screen reader labels "Main navigation", "Mobile navigation", "Toggle navigation".
Examples:
aria-label="{{ loop.index }} of {{ slides | length }}"
aria-label="Go to slide {{ loop.index }}"
return "$" + amount.toLocaleString("en-US") + " / month";
The calculator also formats the amount with a fixed dollar sign and the US number format, while the labels speak of lakhs (see report 47).
Steps to reproduce¶
- Install Drupal CMS with Goodwell in a language other than English (e.g. German) and a complete translation of the content.
- Open the front page and use the premium calculator; look at the testimonial slider.
- The texts listed above are English; there is no string to translate in Interface translation.
Proposed resolution¶
Pass every interface text through t(), with placeholders for the variable parts, e.g.
{{ 'Estimated monthly premium'|t }}
aria-label="{{ '@current of @total'|t({'@current': loop.index, '@total': slides|length}) }}"
aria-label="{{ 'Go to slide @number'|t({'@number': loop.index}) }}"
For the JavaScript text, either use Drupal.t() with a dependency on core/drupal, or let the template pass the translated text in a data attribute, e.g. data-per-month="{{ ' / month'|t }}". Format the amount with the page language instead of en-US.
Workaround: the German installer dcgi rewrites the templates and the script this way before the content import, and dcle ships German translations of the texts.
Additional information¶
Found with Goodwell 1.0.0 on Drupal CMS 2.2.1 and Canvas 1.12.0 (October 2026). The front page of the template loads no Drupal object for anonymous visitors, so Drupal.t() alone is not enough without the library dependency. None of these strings occurs in the versioned settings of the Canvas components, so translating them is safe (report 02).
Copy to drupal.org
Issue title:
Interface texts of the theme and the premium calculator are hard-coded in English
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>The Goodwell theme writes its own interface texts directly into the Twig templates and into JavaScript, without <code>t()</code>. On a site in another language they stay English, and no translation can reach them. Visible on the front page of the template:</p>
<ul>
<li>Premium calculator: "I am", "Male", "Female", "My Age", "years", "I want cover of", "Cover amount in lakhs", "Estimated monthly premium", "Indicative only, subject to underwriting", "My age in years", and the result " / month", which <code>premium-calculator.js</code> appends in JavaScript.</li>
<li>Testimonial slider: "Testimonials", "Slide navigation" and the screen reader labels "1 of 3" and "Go to slide 1", built from the loop index.</li>
<li>Further texts: "Read More", "Question", "Industry awards", and the screen reader labels "Main navigation", "Mobile navigation", "Toggle navigation".</li>
</ul>
<p>Examples:</p>
<code>aria-label="{{ loop.index }} of {{ slides | length }}"
aria-label="Go to slide {{ loop.index }}"</code>
<code>return "$" + amount.toLocaleString("en-US") + " / month";</code>
<p>The calculator also formats the amount with a fixed dollar sign and the US number format, while the labels speak of lakhs (see <a href="https://project.pages.drupalcode.org/dcle/issues/47-goodwell-content-quality/">report 47</a>).</p>
<h3 id="summary-steps-reproduce">Steps to reproduce</h3>
<ol>
<li>Install Drupal CMS with Goodwell in a language other than English (e.g. German) and a complete translation of the content.</li>
<li>Open the front page and use the premium calculator; look at the testimonial slider.</li>
<li>The texts listed above are English; there is no string to translate in Interface translation.</li>
</ol>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Pass every interface text through <code>t()</code>, with placeholders for the variable parts, e.g.</p>
<code>{{ 'Estimated monthly premium'|t }}
aria-label="{{ '@current of @total'|t({'@current': loop.index, '@total': slides|length}) }}"
aria-label="{{ 'Go to slide @number'|t({'@number': loop.index}) }}"</code>
<p>For the JavaScript text, either use <code>Drupal.t()</code> with a dependency on <code>core/drupal</code>, or let the template pass the translated text in a data attribute, e.g. <code>data-per-month="{{ ' / month'|t }}"</code>. Format the amount with the page language instead of <code>en-US</code>.</p>
<p>Workaround: the German installer <a href="https://www.drupal.org/project/dcgi">dcgi</a> rewrites the templates and the script this way before the content import, and <a href="https://www.drupal.org/project/dcle">dcle</a> ships German translations of the texts.</p>
<h3>Additional information</h3>
<p>Found with Goodwell 1.0.0 on Drupal CMS 2.2.1 and Canvas 1.12.0 (October 2026). The front page of the template loads no <code>Drupal</code> object for anonymous visitors, so <code>Drupal.t()</code> alone is not enough without the library dependency. None of these strings occurs in the versioned settings of the Canvas components, so translating them is safe (<a href="https://project.pages.drupalcode.org/dcle/issues/02-canvas-translation-changes-component-version/">report 02</a>).</p>