I’m having a bit of a problem with using placeholders in translations.
most of the app I’m making is done, I just need to translate it, as part of that, I also need to translate the copyright notice, and that copyright needs a date, where the date should be changes by language, so I wanted to use a placeholder and then replace that with the date as provided by the date()-function.
now it does replace it with the date, but ‘it’ in this case is all text, not the placeholder.
so the result is just ‘2014’ and not “copyright © 2014 by me, All rights reserved.”
I have this in the code:
$copyright_date = date('Y');
Yii::t('main', 'Copyright © {date} by Me, All Rights Reserved.', array( '{date}' => $copyright_date));
and in a translation file (for dutch):
return array(
'Copyright © {date} by Me, All Rights Reserved.' => 'Copyright © {date}, ik, Alle rechten voorbehouden.',
but on the page this literly turns to just ‘2014’, all other text is gone.