pluf2

pluf2 Commit Details


Date:2009-01-31 14:18:02 (15 years 10 months ago)
Author:Jürgen Hörmann
Branch:master
Commit:29b5d9d1e85567bafc4547775c287faae1915317
Parents: 686ebdbf458a1bc3dda577e8b676c8d6ccd85449
Message:Fixed issue 125, properly handle singular/plural forms in Date.php.

ngettext is now used to correctly handles the different plural forms.
Changes:

File differences

src/Pluf/Date.php
168168
169169
170170
171
172
173
174
175171
176172
177173
178174
179175
180176
181
182
183
184
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
185196
197
186198
187199
188200
$retain = 1;
}
}
$val = array(__('year'), __('month'), __('day'), __('hour'),
__('minute'), __('second'));
$vals = array(__('years'), __('months'), __('days'), __('hours'),
__('minutes'), __('seconds'));
$res = '';
$total = 0;
for ($i=0; $i<5; $i++) {
if ($diffs[$i] > 0) {
$total++;
$res .= $diffs[$i].' ';
if ($diffs[$i] > 1) {
$res .= $vals[$i].' ';
} else {
$res .= $val[$i].' ';
switch ($i) {
case 0:
$res .= ngettext('year', 'years', $diffs[$i]);
break;
case 1:
$res .= ngettext('month', 'months', $diffs[$i]);
break;
case 2:
$res .= ngettext('day', 'days', $diffs[$i]);
break;
case 3:
$res .= ngettext('hour', 'hours', $diffs[$i]);
break;
case 4:
$res .= ngettext('minute', 'minutes', $diffs[$i]);
break;
case 5:
$res .= ngettext('second', 'seconds', $diffs[$i]);
break;
}
$res .= ' ';
}
if ($total >= $blocks) break;
}

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.05396s using 14 queries.