1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
( function () {
/* global moment:false */
'use strict';
var momentOrigLocale = moment.locale();
// Set up new 'short relative time' locale strings for momentjs
moment.defineLocale( 'echo-shortRelativeTime', {
relativeTime: function ( number, withoutSuffix, key ) {
var keymap = {
s: 'seconds',
m: 'minutes',
mm: 'minutes',
h: 'hours',
hh: 'hours',
d: 'days',
dd: 'days',
M: 'months',
MM: 'months',
y: 'years',
yy: 'years'
};
// The following messages are used here:
// * notification-timestamp-ago-seconds
// * notification-timestamp-ago-minutes
// * notification-timestamp-ago-hours
// * notification-timestamp-ago-days
// * notification-timestamp-ago-months
// * notification-timestamp-ago-years
return mw.msg( 'notification-timestamp-ago-' + keymap[ key ], mw.language.convertNumber( number ) );
},
calendar: {
// Brackets must surround this output, otherwise moment thinks
// this is a format string, and replaces all 'm' with minutes,
// 's' with seconds, 'd' with days, etc, which is very amusing,
// but entirely unhelpful
sameDay: '[' + mw.msg( 'notification-timestamp-today' ) + ']',
lastDay: '[' + mw.msg( 'notification-timestamp-yesterday' ) + ']',
lastWeek: function () {
return '[' + mw.msg(
[
'sunday',
'monday',
'tuesday',
'wednesday',
'thursday',
'friday',
'saturday'
][ this.day() ] ) + ']';
}
}
} );
// Reset back to original locale
moment.locale( momentOrigLocale );
}() );
|