2016-04-20 00:52:27 +00:00
|
|
|
( function ( mw ) {
|
|
|
|
/*global moment:false */
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var momentOrigLocale = moment.locale();
|
2016-03-16 22:47:20 +00:00
|
|
|
|
2016-04-20 00:52:27 +00:00
|
|
|
// 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'
|
|
|
|
};
|
|
|
|
return mw.msg( 'notification-timestamp-ago-' + keymap[ key ], mw.language.convertNumber( number ) );
|
2016-03-16 22:47:20 +00:00
|
|
|
},
|
|
|
|
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' ) + ']',
|
2016-06-13 11:44:25 +00:00
|
|
|
lastWeek: function () {
|
|
|
|
return '[' + mw.msg(
|
|
|
|
[
|
|
|
|
'sunday',
|
|
|
|
'monday',
|
|
|
|
'tuesday',
|
|
|
|
'wednesday',
|
|
|
|
'thursday',
|
|
|
|
'friday',
|
|
|
|
'saturday'
|
|
|
|
][ this.day() ] ) + ']';
|
|
|
|
}
|
2016-03-16 22:47:20 +00:00
|
|
|
}
|
|
|
|
} );
|
2016-04-20 00:52:27 +00:00
|
|
|
// Reset back to original locale
|
|
|
|
moment.locale( momentOrigLocale );
|
|
|
|
} )( mediaWiki );
|