•  
      request #22673 Fatal error with double quotes in translated mustache
    Infos
    #22673
    Joris MASSON (jmasson)
    2021-08-24 15:59
    2021-08-24 15:28
    24232
    Details
    Fatal error with double quotes in translated mustache

    Given the following mustache template:

    {{# dgettext }}
        tuleap-program_management |
        Values "%s" are not found in every tracker, please check tracker |
        {{ missing_values }}
    {{/ dgettext }}
    

    When you browse Tuleap in French language and you render this template, it will cause a Fatal error:

    Fatal error: Uncaught ValueError: The arguments array must contain 2 items, 1 given in /usr/share/tuleap/src/common/templating/mustache/GettextHelper.php:124 Stack trace: #0 /usr/share/tuleap/src/common/templating/mustache/GettextHelper.php(124): vsprintf() #1 /usr/share/tuleap/src/common/templating/mustache/GettextHelper.php(77): Tuleap\Templating\Mustache\GettextHelper->getFormattedText() #2 /usr/share/tuleap/src/common/templating/mustache/MustacheEngine.php(51): Tuleap\Templating\Mustache\GettextHelper->dgettext() #3
    [and so on...]
    

    It should not crash when double quote character " is used in a translated string

    Dev tools
    All
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Empty
    Declined
    2021-08-24
    Attachments
    Empty
    References
    References list is empty

    Follow-ups

    User avatar
    Joris MASSON (jmasson)2021-08-24 15:59

    The bug was in the data. When there are two %s placeholders in the French translation but only one %s in the source English sentence, it will crash, which is to be expected. We should fix our translation.


    • Status changed from New to Declined
    • Close date set to 2021-08-24
    User avatar
    Joris MASSON (jmasson)2021-08-24 15:38
    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes