Issue Bug Closed

#91301Wrong encoding for "displayResults"

Gerhard Rupp 05/04/20, 23:59 updated 06/07/24, 00:15

Description

As some values in locallang.xlf file contain entities for angle brackets these have to be decoded before frontend rendering in partial Search.html

F. e.

<is:pageBrowsingResults numberOfResults="{result.count}" currentPage="{searchParams.pointer}" resultsPerPage="{searchParams.numberOfResults}" />

should be wrapped with format.htmlentitiesDecode ViewHelper

<f:format.htmlentitiesDecode><is:pageBrowsingResults numberOfResults="{result.count}" currentPage="{searchParams.pointer}" resultsPerPage="{searchParams.numberOfResults}" /></f:format.htmlentitiesDecode>

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Files 1

History 9

  1. Benni Mack commented and changed attached Screen Shot 2020-05-12 at 15.28.55.png status New Needs Feedback 05/12/20, 15:30

    Hey Gerhard,

    I tried to reproduce this issue with TYPO3 v10.4.1 – but without success.. maybe the change in issue #90484 already solves your issue. Can you try again with TYPO3 v9.5.17 ?

  2. Gerhard Rupp commented 05/12/20, 22:19

    Error still exists in 9.5.17 but seems to be caused by the already encoded value in the German language file.

    locallang.xlf

    <trans-unit id="displayResults" resname="displayResults">
      <source><![CDATA[Displaying results <strong>%1$s to %2$s</strong> out of <strong>%3$s</strong>]]></source>
    </trans-unit>

    de.locallang.xlf

    <trans-unit id="displayResults" resname="displayResults" approved="yes">
      <source><![CDATA[Displaying results <strong>%1$s to %2$s</strong> out of <strong>%3$s</strong>]]></source>
      <target state="final"><![CDATA[Anzeige der Ergebnisse &lt;strong&gt;%1$s bis %2$s&lt;/strong&gt; von insgesamt &lt;strong&gt;%3$s&lt;/strong&gt;]]></target>
    </trans-unit>
  3. Georg Ringer commented 05/13/20, 09:15

    this is a problem during the crowdin migration. detailed report

    Original file having cdata + tags
    ```<source><![CDATA[Displaying results <strong>%1$s to %2$s</strong> out of <strong>%3$s</strong>]]></source>```
    the export I did from pootle had this
    ```<trans-unit id="displayResults" resname="displayResults" approved="yes">
                    <source>Displaying results <strong>%1$s to %2$s</strong> out of <strong>%3$s</strong></source>
                    <target state="translated">Anzeige der Ergebnisse <strong>%1$s bis %2$s</strong> von insgesamt <strong>%3$s</strong></target>
                </trans-unit>```
    so no cdata for the source and no cdata on the target + using `<` instead of `<`.
    
    I uploaded those files to crowdin and now there seems to be some magic happening.
    I *guess* you match now the source of the file also to the real source language provided previously.
    However, now the source contains cdata + proper tags which is fine *but* the translations now contain cdata as well but still the original translation which is now escaped and wrong
    
    ```<trans-unit id="displayResults" resname="displayResults" approved="yes">
    <source><![CDATA[Displaying results <strong>%1$s to %2$s</strong> out of <strong>%3$s</strong>]]></source>
    <target state="final"><![CDATA[Anzeige der Ergebnisse <strong>%1$s bis %2$s</strong> von insgesamt <strong>%3$s</strong>]]></target>
    </trans-unit>```
    From my side it is wrong to add cdata automatically to the target but leave the content as it is.
    
    Is it correct that I need to fix that myself, also e.g. using the mass replace tool
  4. Georg Ringer changed Duplicated by #91386 05/13/20, 21:11

  5. Georg Ringer changed category status Needs Feedback Accepted assigned to Georg Ringer 05/13/20, 21:12

  6. Andreas Krämer commented 08/20/21, 07:25

    The DE translation is working in TYPO3 10.4.20.
    But the ES translation is still wrong:

    <trans-unit id="displayResults" resname="displayResults" approved="yes">
      <source><![CDATA[Displaying results <strong>%1$s to %2$s</strong> out of <strong>%3$s</strong>]]></source>
      <target state="final"><![CDATA[Mostrando resultados &lt;strong&gt;%1$s a %2$s&lt;/strong&gt; de &lt;strong&gt;%3$s&lt;/strong&gt;]]></target>
    </trans-unit>

    I just fetched it from Crowdin. FR translation is working, too.

    For now I “fixed” it this way for ES:

    plugin.tx_indexedsearch._LOCAL_LANG.es.displayResults = Mostrando resultados <strong>%1$s a %2$s</strong> de <strong>%3$s</strong>

    (https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/TopLevelObjects/Plugin.html#local-lang-lang-key-label-key)

  7. Mathias Schreiber changed Sprint Focus Remote Sprint 03/08/22, 12:09

  8. Georg Ringer commented 06/03/24, 19:56

    this has been IMO fixed on crowdin, therefore closing this issue. if still valid, please contact me on slack or open a new issue and reference this one

  9. Georg Ringer changed status Accepted Closed 06/07/24, 00:15