mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 15:52:12 +08:00
55c01d3320
support more languages.
78 lines
2.8 KiB
JavaScript
78 lines
2.8 KiB
JavaScript
// moment.js locale configuration
|
|
// locale : 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.defineLocale('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.
|
|
}
|
|
});
|
|
}));
|