Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
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
edx
edx-platform
Commits
7e8d700b
Commit
7e8d700b
authored
Jan 24, 2014
by
Greg Price
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2267 from edx/gprice/timeago-better-i18n
Modify jquery.timeago to better support i18n
parents
4c1df704
a83e2c70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
18 deletions
+9
-18
common/static/js/src/jquery.timeago.locale.js
+2
-5
common/static/js/vendor/jquery.timeago.js
+7
-13
No files found.
common/static/js/src/jquery.timeago.locale.js
View file @
7e8d700b
jQuery
.
timeago
.
settings
.
strings
=
{
jQuery
.
timeago
.
settings
.
strings
=
{
prefixAgo
:
pgettext
(
"Prefix indicating time ago"
,
""
),
formatAgo
:
gettext
(
"%s ago"
),
prefixFromNow
:
pgettext
(
"Prefix indicating time from now"
,
""
),
formatFromNow
:
gettext
(
"%s from now"
),
suffixAgo
:
pgettext
(
"Suffix indicating time ago"
,
"ago"
),
suffixFromNow
:
pgettext
(
"Suffix indicating time from now"
,
"from now"
),
seconds
:
gettext
(
"less than a minute"
),
seconds
:
gettext
(
"less than a minute"
),
minute
:
gettext
(
"about a minute"
),
minute
:
gettext
(
"about a minute"
),
minutes
:
function
(
value
)
{
return
ngettext
(
"%d minute"
,
"%d minutes"
,
value
)},
minutes
:
function
(
value
)
{
return
ngettext
(
"%d minute"
,
"%d minutes"
,
value
)},
...
@@ -14,6 +12,5 @@ jQuery.timeago.settings.strings = {
...
@@ -14,6 +12,5 @@ jQuery.timeago.settings.strings = {
months
:
function
(
value
)
{
return
ngettext
(
"%d month"
,
"%d months"
,
value
)
},
months
:
function
(
value
)
{
return
ngettext
(
"%d month"
,
"%d months"
,
value
)
},
year
:
gettext
(
"about a year"
),
year
:
gettext
(
"about a year"
),
years
:
function
(
value
)
{
return
ngettext
(
"%d year"
,
"%d years"
,
value
)
},
years
:
function
(
value
)
{
return
ngettext
(
"%d year"
,
"%d years"
,
value
)
},
wordSeparator
:
pgettext
(
"Word separator"
,
" "
),
numbers
:
[]
numbers
:
[]
};
};
common/static/js/vendor/jquery.timeago.js
View file @
7e8d700b
...
@@ -6,12 +6,12 @@
...
@@ -6,12 +6,12 @@
* @version 0.11.4
* @version 0.11.4
* @requires jQuery v1.2.3+
* @requires jQuery v1.2.3+
* @author Ryan McGeary
* @author Ryan McGeary
* @license MIT License - http://www.opensource.org/licenses/mit-license.php
*
*
* For usage and examples, visit:
* For usage and examples, visit:
* http://timeago.yarp.com/
* http://timeago.yarp.com/
*
*
* Copyright (c) 2008-2012, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org)
* Portions copyright (c) 2008-2012, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org)
* and licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
*/
*/
(
function
(
$
)
{
(
function
(
$
)
{
$
.
timeago
=
function
(
timestamp
)
{
$
.
timeago
=
function
(
timestamp
)
{
...
@@ -32,10 +32,8 @@
...
@@ -32,10 +32,8 @@
refreshMillis
:
60000
,
refreshMillis
:
60000
,
allowFuture
:
false
,
allowFuture
:
false
,
strings
:
{
strings
:
{
prefixAgo
:
null
,
formatAgo
:
"%s ago"
,
prefixFromNow
:
null
,
formatFromNow
:
"%s from now"
,
suffixAgo
:
"ago"
,
suffixFromNow
:
"from now"
,
seconds
:
"less than a minute"
,
seconds
:
"less than a minute"
,
minute
:
"about a minute"
,
minute
:
"about a minute"
,
minutes
:
"%d minutes"
,
minutes
:
"%d minutes"
,
...
@@ -47,18 +45,15 @@
...
@@ -47,18 +45,15 @@
months
:
"%d months"
,
months
:
"%d months"
,
year
:
"about a year"
,
year
:
"about a year"
,
years
:
"%d years"
,
years
:
"%d years"
,
wordSeparator
:
" "
,
numbers
:
[]
numbers
:
[]
}
}
},
},
inWords
:
function
(
distanceMillis
)
{
inWords
:
function
(
distanceMillis
)
{
var
$l
=
this
.
settings
.
strings
;
var
$l
=
this
.
settings
.
strings
;
var
prefix
=
$l
.
prefixAgo
;
var
format
=
$l
.
formatAgo
;
var
suffix
=
$l
.
suffixAgo
;
if
(
this
.
settings
.
allowFuture
)
{
if
(
this
.
settings
.
allowFuture
)
{
if
(
distanceMillis
<
0
)
{
if
(
distanceMillis
<
0
)
{
prefix
=
$l
.
prefixFromNow
;
format
=
$l
.
formatFromNow
;
suffix
=
$l
.
suffixFromNow
;
}
}
}
}
...
@@ -86,8 +81,7 @@
...
@@ -86,8 +81,7 @@
years
<
1.5
&&
substitute
(
$l
.
year
,
1
)
||
years
<
1.5
&&
substitute
(
$l
.
year
,
1
)
||
substitute
(
$l
.
years
,
Math
.
round
(
years
));
substitute
(
$l
.
years
,
Math
.
round
(
years
));
var
separator
=
$l
.
wordSeparator
===
undefined
?
" "
:
$l
.
wordSeparator
;
return
$
.
trim
(
format
.
replace
(
/%s/i
,
words
));
return
$
.
trim
([
prefix
,
words
,
suffix
].
join
(
separator
));
},
},
parse
:
function
(
iso8601
)
{
parse
:
function
(
iso8601
)
{
var
s
=
$
.
trim
(
iso8601
);
var
s
=
$
.
trim
(
iso8601
);
...
...
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