I have a case where the translation is being dynamically constructed to create a simple sentence based on user input. The phrase when complete looks like this
From {from} until {until} on {on}
What I would like to achieve is that if a parameter is null then that part of the text should be omitted.
For example, the translation
Yii::t('test', 'From {from} until {until} on {on}', [
'from' => 'some html',
'until' => null,
'on' => 'some other html',
])
I would like it to generate something like
From some HTML on some other HTML
I’ve seen cases such as plural, select, etc but I can’t see if there’s a way to achieve this conditional branching and how.
Any hints are appreciated.