fixing date duration i18n
This commit is contained in:
parent
0c2ca8184c
commit
47419b9602
3 changed files with 51 additions and 7 deletions
|
|
@ -826,34 +826,35 @@ The number of seconds in the interval.
|
|||
sub secondsToInterval {
|
||||
my $self = shift;
|
||||
my $seconds = shift;
|
||||
my $i18n = WebGUI::International->new($self->session, 'WebGUI');
|
||||
my ($interval, $units);
|
||||
if ($seconds >= 31536000) {
|
||||
$interval = round($seconds/31536000);
|
||||
$units = "years";
|
||||
$units = $i18n->get("years");
|
||||
}
|
||||
elsif ($seconds >= 2592000) {
|
||||
$interval = round($seconds/2592000);
|
||||
$units = "months";
|
||||
$units = $i18n->get("months");
|
||||
}
|
||||
elsif ($seconds >= 604800) {
|
||||
$interval = round($seconds/604800);
|
||||
$units = "weeks";
|
||||
$units = $i18n->get("weeks");
|
||||
}
|
||||
elsif ($seconds >= 86400) {
|
||||
$interval = round($seconds/86400);
|
||||
$units = "days";
|
||||
$units = $i18n->get("days");
|
||||
}
|
||||
elsif ($seconds >= 3600) {
|
||||
$interval = round($seconds/3600);
|
||||
$units = "hours";
|
||||
$units = $i18n->get("hours");
|
||||
}
|
||||
elsif ($seconds >= 60) {
|
||||
$interval = round($seconds/60);
|
||||
$units = "minutes";
|
||||
$units = $i18n->get("minutes");
|
||||
}
|
||||
else {
|
||||
$interval = $seconds;
|
||||
$units = "seconds";
|
||||
$units = $i18n->get("seconds");
|
||||
}
|
||||
return ($interval, $units);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4211,6 +4211,48 @@ Users may override this setting in their profile.
|
|||
context => q{i18n label for YUI paginator},
|
||||
},
|
||||
|
||||
'years' => {
|
||||
message => q{years},
|
||||
lastUpdated => 1226706547,
|
||||
context => q{i18n label for time duration in WebGUI::DateTime},
|
||||
},
|
||||
|
||||
'months' => {
|
||||
message => q{months},
|
||||
lastUpdated => 1226706547,
|
||||
context => q{i18n label for time duration in WebGUI::DateTime},
|
||||
},
|
||||
|
||||
'weeks' => {
|
||||
message => q{weeks},
|
||||
lastUpdated => 1226706547,
|
||||
context => q{i18n label for time duration in WebGUI::DateTime},
|
||||
},
|
||||
|
||||
'days' => {
|
||||
message => q{days},
|
||||
lastUpdated => 1226706547,
|
||||
context => q{i18n label for time duration in WebGUI::DateTime},
|
||||
},
|
||||
|
||||
'hours' => {
|
||||
message => q{hours},
|
||||
lastUpdated => 1226706547,
|
||||
context => q{i18n label for time duration in WebGUI::DateTime},
|
||||
},
|
||||
|
||||
'minutes' => {
|
||||
message => q{minutes},
|
||||
lastUpdated => 1226706547,
|
||||
context => q{i18n label for time duration in WebGUI::DateTime},
|
||||
},
|
||||
|
||||
'seconds' => {
|
||||
message => q{seconds},
|
||||
lastUpdated => 1226706547,
|
||||
context => q{i18n label for time duration in WebGUI::DateTime},
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue