05 · String props with x-formatting-context (contentMediaType: text/html) are not translatable¶
| Project | Canvas |
| Component | Translation |
| Category | Bug report |
| Priority | Normal |
| Status | Reported upstream as #3592154 |
Problem/Motivation¶
For type: string props with x-formatting-context: block (i.e. markup), JsonSchemaPropsComponentInstanceInputsConfigSchemaGenerator generates type: ignore without translatable, although the value is prose. Example: body of provus_base_theme:testimonial (Provus EDU site template) – the testimonial quotes cannot be translated and stay English on a translated site, while name and role of the same component are translatable.
Steps to reproduce¶
- Install Drupal CMS with Provus EDU.
- Run:
$source = Component::load('sdc.provus_base_theme.testimonial')->getComponentSource(); $mapping = (new JsonSchemaPropsComponentInstanceInputsConfigSchemaGenerator())->getConfigSchemaMapping($source); $mapping['body']is{"type":"ignore","requiredKey":false}– notranslatable.
Proposed resolution¶
Treat string props with x-formatting-context or contentMediaType: text/html as translatable.
Remaining tasks¶
Patch + test.
Additional information¶
Related to the issue about {value, format} props. Workaround in dcle.
Copy to drupal.org
Issue title:
String props with x-formatting-context (contentMediaType: text/html) are not translatable
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>For <code>type: string</code> props with <code>x-formatting-context: block</code> (i.e. markup), <code>JsonSchemaPropsComponentInstanceInputsConfigSchemaGenerator</code> generates <code>type: ignore</code> without <code>translatable</code>, although the value is prose. Example: <code>body</code> of <code>provus_base_theme:testimonial</code> (Provus EDU site template) – the testimonial quotes cannot be translated and stay English on a translated site, while <code>name</code> and <code>role</code> of the same component are translatable.</p>
<h3 id="summary-steps-reproduce">Steps to reproduce</h3>
<ol>
<li>Install Drupal CMS with Provus EDU.</li>
<li>Run:
<code>php
$source = Component::load('sdc.provus_base_theme.testimonial')->getComponentSource();
$mapping = (new JsonSchemaPropsComponentInstanceInputsConfigSchemaGenerator())->getConfigSchemaMapping($source);</code></li>
<li><code>$mapping['body']</code> is <code>{"type":"ignore","requiredKey":false}</code> – no <code>translatable</code>.</li>
</ol>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Treat string props with <code>x-formatting-context</code> or <code>contentMediaType: text/html</code> as translatable.</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<p>Patch + test.</p>
<h3>Additional information</h3>
<p>Related to the issue about <code>{value, format}</code> props. Workaround in <code>dcle</code>.</p>