Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

FlashMessenger translator does not support parameterised string #140

@twmobius

Description

@twmobius

The standard format (to my knowledge) of translating a string containing a variable would be:

<?= sprintf($this->translate(_("Ticket '%s' has been saved"), $ticket->getName()); ?>

The way FlashMessenger uses the Translator does not allow for such usage, and restricts the user to simple strings.

I extended the View\Helper\FlashMessenger to allow for the translator to sprintf() parameters into the string, but that required me to pass an array to the addMessage() like so:

$this->flashMessenger->setNamespace('xxx')->addMessage([ _("Ticket '%s' has been saved"), $ticket->getName() ]);

I recently did an composer update and it came to my attention now that the flashMessenger addMessage() function has changed it's definition to accept only strings.

Am I wrong on this? Should the FlashMessenger view helper be updated or could the addMessage definition become more loose?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions