mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-17 21:04:11 +00:00
5d419682f5
Add moment.js ( http://momentjs.com/ ) as a ResourceLoader module and use it to parse and format date strings. Moment.js seems to be the least bad option right now; eventually it should be replaced by i18n functionality in core Javascript modules. Change-Id: I332655778be3d694781b83fa5dea1e59770d8866
78 lines
2.8 KiB
JavaScript
78 lines
2.8 KiB
JavaScript
// moment.js language configuration
|
|
// language : latvian (lv)
|
|
// author : Kristaps Karlsons : https://github.com/skakri
|
|
|
|
(function (factory) {
|
|
if (typeof define === 'function' && define.amd) {
|
|
define(['moment'], factory); // AMD
|
|
} else if (typeof exports === 'object') {
|
|
module.exports = factory(require('../moment')); // Node
|
|
} else {
|
|
factory(window.moment); // Browser global
|
|
}
|
|
}(function (moment) {
|
|
var units = {
|
|
'mm': 'minūti_minūtes_minūte_minūtes',
|
|
'hh': 'stundu_stundas_stunda_stundas',
|
|
'dd': 'dienu_dienas_diena_dienas',
|
|
'MM': 'mēnesi_mēnešus_mēnesis_mēneši',
|
|
'yy': 'gadu_gadus_gads_gadi'
|
|
};
|
|
|
|
function format(word, number, withoutSuffix) {
|
|
var forms = word.split('_');
|
|
if (withoutSuffix) {
|
|
return number % 10 === 1 && number !== 11 ? forms[2] : forms[3];
|
|
} else {
|
|
return number % 10 === 1 && number !== 11 ? forms[0] : forms[1];
|
|
}
|
|
}
|
|
|
|
function relativeTimeWithPlural(number, withoutSuffix, key) {
|
|
return number + ' ' + format(units[key], number, withoutSuffix);
|
|
}
|
|
|
|
return moment.lang('lv', {
|
|
months : "janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris".split("_"),
|
|
monthsShort : "jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec".split("_"),
|
|
weekdays : "svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena".split("_"),
|
|
weekdaysShort : "Sv_P_O_T_C_Pk_S".split("_"),
|
|
weekdaysMin : "Sv_P_O_T_C_Pk_S".split("_"),
|
|
longDateFormat : {
|
|
LT : "HH:mm",
|
|
L : "DD.MM.YYYY",
|
|
LL : "YYYY. [gada] D. MMMM",
|
|
LLL : "YYYY. [gada] D. MMMM, LT",
|
|
LLLL : "YYYY. [gada] D. MMMM, dddd, LT"
|
|
},
|
|
calendar : {
|
|
sameDay : '[Šodien pulksten] LT',
|
|
nextDay : '[Rīt pulksten] LT',
|
|
nextWeek : 'dddd [pulksten] LT',
|
|
lastDay : '[Vakar pulksten] LT',
|
|
lastWeek : '[Pagājušā] dddd [pulksten] LT',
|
|
sameElse : 'L'
|
|
},
|
|
relativeTime : {
|
|
future : "%s vēlāk",
|
|
past : "%s agrāk",
|
|
s : "dažas sekundes",
|
|
m : "minūti",
|
|
mm : relativeTimeWithPlural,
|
|
h : "stundu",
|
|
hh : relativeTimeWithPlural,
|
|
d : "dienu",
|
|
dd : relativeTimeWithPlural,
|
|
M : "mēnesi",
|
|
MM : relativeTimeWithPlural,
|
|
y : "gadu",
|
|
yy : relativeTimeWithPlural
|
|
},
|
|
ordinal : '%d.',
|
|
week : {
|
|
dow : 1, // Monday is the first day of the week.
|
|
doy : 4 // The week that contains Jan 4th is the first week of the year.
|
|
}
|
|
});
|
|
}));
|