t2() behaves differently in v8.3 and v8.4?
Permalink
I've just notices that this code:
shows nothing in C5 v.8.3* and shows the value of $duration in C5 v.8.4*. To show the duration value in v8.3* I have to use:
Has the t2() changed from v.8.3 to v8.4?
echo t2('%d day', '%d days', $duration);
shows nothing in C5 v.8.3* and shows the value of $duration in C5 v.8.4*. To show the duration value in v8.3* I have to use:
echo $duration . ' ' . t2('%d day', '%d days', $duration);
Has the t2() changed from v.8.3 to v8.4?
Nothing changed
But why then does it behave differently?
It may be nothing to do with t2. What you are doing to set $duration?
controller:
$pickup_dt = $this->app->make('helper/form/date_time')->translate('pickup_dt', null); $dropoff_dt = $this->app->make('helper/form/date_time')->translate('dropoff_dt', null); $duration = ceil((strtotime($dropoff_dt) - strtotime($pickup_dt)) / (60 * 60 * 24)); $duration = ($duration < 1) ? 1 : $duration; $this->set('duration', $duration);
I've just realized I forgot the '%d' in the language file:
Doh! Should be this:
msgid "%d day" msgid_plural "%d days" msgstr[0] "сутки" msgstr[1] "суток" msgstr[2] "суток"
Doh! Should be this:
msgid "%d day" msgid_plural "%d days" msgstr[0] "%d сутки" msgstr[1] "%d суток" msgstr[2] "%d суток"