Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
ced45c54
Commit
ced45c54
authored
Mar 12, 2014
by
David Renty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Call Yii::t everytime instead of passing a template variable
parent
fd7ed282
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
Formatter.php
framework/base/Formatter.php
+8
-10
No files found.
framework/base/Formatter.php
View file @
ced45c54
...
...
@@ -457,7 +457,7 @@ class Formatter extends Component
}
/**
* Formats the value as the time elapsed since then in human readable form.
* Formats the value as
the time elapsed since then in human readable form.
* @param integer|string|DateTime $value the value to be formatted. The following
* types of value are supported:
*
...
...
@@ -482,27 +482,25 @@ class Formatter extends Component
if
(
$interval
->
y
>=
1
)
{
$delta
=
$interval
->
y
;
$format
=
'{delta, plural, =1{a year} other{# years}} ago'
;
return
Yii
::
t
(
'yii'
,
'{delta, plural, =1{a year} other{# years}} ago'
,
[
'delta'
=>
$delta
])
;
}
elseif
(
$interval
->
m
>=
1
)
{
$delta
=
$interval
->
m
;
$format
=
'{delta, plural, =1{a month} other{# months}} ago'
;
return
Yii
::
t
(
'yii'
,
'{delta, plural, =1{a month} other{# months}} ago'
,
[
'delta'
=>
$delta
])
;
}
elseif
(
$interval
->
d
>=
7
)
{
$delta
=
floor
(
$interval
->
d
/
7
);
$format
=
'{delta, plural, =1{a week} other{# weeks}} ago'
;
return
Yii
::
t
(
'yii'
,
'{delta, plural, =1{a week} other{# weeks}} ago'
,
[
'delta'
=>
$delta
])
;
}
elseif
(
$interval
->
d
>=
1
)
{
$delta
=
$interval
->
d
;
$format
=
'{delta, plural, =1{yesterday} other{# days ago}}'
;
return
Yii
::
t
(
'yii'
,
'{delta, plural, =1{yesterday} other{# days ago}}'
,
[
'delta'
=>
$delta
])
;
}
elseif
(
$interval
->
h
>=
1
)
{
$delta
=
$interval
->
h
;
$format
=
'{delta, plural, =1{an hour} other{# hours}} ago'
;
return
Yii
::
t
(
'yii'
,
'{delta, plural, =1{an hour} other{# hours}} ago'
,
[
'delta'
=>
$delta
])
;
}
elseif
(
$interval
->
i
>=
1
)
{
$delta
=
$interval
->
i
;
$format
=
'{delta, plural, =1{a minute} other{# minutes}} ago'
;
return
Yii
::
t
(
'yii'
,
'{delta, plural, =1{a minute} other{# minutes}} ago'
,
[
'delta'
=>
$delta
])
;
}
else
{
$delta
=
$interval
->
s
;
$format
=
'{delta, plural, =1{a second} other{# seconds}} ago'
;
return
Yii
::
t
(
'yii'
,
'{delta, plural, =1{a second} other{# seconds}} ago'
,
[
'delta'
=>
$delta
])
;
}
return
Yii
::
t
(
'yii'
,
$format
,
[
'delta'
=>
$delta
]);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment