| | 210 | } |
| | 211 | return $result; |
| | 212 | } |
| | 213 | } elsif ($style == 3) { |
| | 214 | if ($delta < 60) { |
| | 215 | return $future ? MT->translate("[quant,_1,second,seconds] from now", $delta) : MT->translate("[quant,_1,second,seconds]", $delta); |
| | 216 | } elsif ($delta <= 3600) { |
| | 217 | # less than 1 hour |
| | 218 | my $min = int(($delta % 3600) / 60); |
| | 219 | my $sec = $delta % 60; |
| | 220 | my $result; |
| | 221 | if ($sec && $min) { |
| | 222 | $result = $future ? MT->translate("[quant,_1,minute,minutes], [quant,_2,second,seconds] from now", $min, $sec) : MT->translate("[quant,_1,minute,minutes], [quant,_2,second,seconds]", $min, $sec); |
| | 223 | } elsif ($min) { |
| | 224 | $result = $future ? MT->translate("[quant,_1,minute,minutes] from now", $min) : MT->translate("[quant,_1,minute,minutes]", $min); |
| | 225 | } elsif ($sec) { |
| | 226 | $result = $future ? MT->translate("[quant,_1,second,seconds] from now", $sec) : MT->translate("[quant,_1,second,seconds]", $sec); |
| | 227 | } |
| | 228 | return $result; |
| | 229 | } elsif ($delta <= 86400) { |
| | 230 | # less than 1 day |
| | 231 | my $hours = int($delta / 3600); |
| | 232 | my $min = int(($delta % 3600) / 60); |
| | 233 | my $result; |
| | 234 | if ($hours && $min) { |
| | 235 | $result = $future ? MT->translate("[quant,_1,hour,hours], [quant,_2,minute,minutes] from now", $hours, $min) : MT->translate("[quant,_1,hour,hours], [quant,_2,minute,minutes]", $hours, $min); |
| | 236 | } elsif ($hours) { |
| | 237 | $result = $future ? MT->translate("[quant,_1,hour,hours] from now", $hours) : MT->translate("[quant,_1,hour,hours]", $hours); |
| | 238 | } elsif ($min) { |
| | 239 | $result = $future ? MT->translate("[quant,_1,minute,minutes] from now", $min) : MT->translate("[quant,_1,minute,minutes]", $min); |
| | 240 | } |
| | 241 | return $result; |
| | 242 | } elsif ($delta <= 604800) { |
| | 243 | # less than 1 week |
| | 244 | my $days = int($delta / 86400); |
| | 245 | my $hours = int(($delta % 86400) / 3600); |
| | 246 | my $result; |
| | 247 | if ($days && $hours) { |
| | 248 | $result = $future ? MT->translate("[quant,_1,day,days], [quant,_2,hour,hours] from now", $days, $hours) : MT->translate("[quant,_1,day,days], [quant,_2,hour,hours]", $days, $hours); |
| | 249 | } elsif ($days) { |
| | 250 | $result = $future ? MT->translate("[quant,_1,day,days] from now", $days) : MT->translate("[quant,_1,day,days]", $days); |
| | 251 | } elsif ($hours) { |
| | 252 | $result = $future ? MT->translate("[quant,_1,hour,hours] from now", $hours) : MT->translate("[quant,_1,hour,hours]", $hours); |