The Stackoverflow user Casimir et Hippolyte gave me this awesome function to replace strings like [[ Something ]] with localized strings being returned with $this->_() function.
$that = $this;
$view = preg_replace_callback('~\[\[\K(?>[^]]++|](?!]))*~', function ($m) use ($that) {
return $that->__($m[0]); }, $view);
It works except that it doesn't replace the brackets. So, if I have "Yes|Ja" my I18n file, and in my view file I write [[ Yes ]] it comes up with [[ Ja ]].
I've spent a few hours trying and googling but unfortunately - nothing. Any ideas?