lv.js (3449B)
1//! moment.js locale configuration 2//! locale : Latvian [lv] 3//! author : Kristaps Karlsons : https://github.com/skakri 4//! author : Jānis Elmeris : https://github.com/JanisE 5 6import moment from '../moment'; 7 8var units = { 9 ss: 'sekundes_sekundēm_sekunde_sekundes'.split('_'), 10 m: 'minūtes_minūtēm_minūte_minūtes'.split('_'), 11 mm: 'minūtes_minūtēm_minūte_minūtes'.split('_'), 12 h: 'stundas_stundām_stunda_stundas'.split('_'), 13 hh: 'stundas_stundām_stunda_stundas'.split('_'), 14 d: 'dienas_dienām_diena_dienas'.split('_'), 15 dd: 'dienas_dienām_diena_dienas'.split('_'), 16 M: 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), 17 MM: 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), 18 y: 'gada_gadiem_gads_gadi'.split('_'), 19 yy: 'gada_gadiem_gads_gadi'.split('_'), 20}; 21/** 22 * @param withoutSuffix boolean true = a length of time; false = before/after a period of time. 23 */ 24function format(forms, number, withoutSuffix) { 25 if (withoutSuffix) { 26 // E.g. "21 minūte", "3 minūtes". 27 return number % 10 === 1 && number % 100 !== 11 ? forms[2] : forms[3]; 28 } else { 29 // E.g. "21 minūtes" as in "pēc 21 minūtes". 30 // E.g. "3 minūtēm" as in "pēc 3 minūtēm". 31 return number % 10 === 1 && number % 100 !== 11 ? forms[0] : forms[1]; 32 } 33} 34function relativeTimeWithPlural(number, withoutSuffix, key) { 35 return number + ' ' + format(units[key], number, withoutSuffix); 36} 37function relativeTimeWithSingular(number, withoutSuffix, key) { 38 return format(units[key], number, withoutSuffix); 39} 40function relativeSeconds(number, withoutSuffix) { 41 return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm'; 42} 43 44export default moment.defineLocale('lv', { 45 months: 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split( 46 '_' 47 ), 48 monthsShort: 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'), 49 weekdays: 50 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split( 51 '_' 52 ), 53 weekdaysShort: 'Sv_P_O_T_C_Pk_S'.split('_'), 54 weekdaysMin: 'Sv_P_O_T_C_Pk_S'.split('_'), 55 weekdaysParseExact: true, 56 longDateFormat: { 57 LT: 'HH:mm', 58 LTS: 'HH:mm:ss', 59 L: 'DD.MM.YYYY.', 60 LL: 'YYYY. [gada] D. MMMM', 61 LLL: 'YYYY. [gada] D. MMMM, HH:mm', 62 LLLL: 'YYYY. [gada] D. MMMM, dddd, HH:mm', 63 }, 64 calendar: { 65 sameDay: '[Šodien pulksten] LT', 66 nextDay: '[Rīt pulksten] LT', 67 nextWeek: 'dddd [pulksten] LT', 68 lastDay: '[Vakar pulksten] LT', 69 lastWeek: '[Pagājušā] dddd [pulksten] LT', 70 sameElse: 'L', 71 }, 72 relativeTime: { 73 future: 'pēc %s', 74 past: 'pirms %s', 75 s: relativeSeconds, 76 ss: relativeTimeWithPlural, 77 m: relativeTimeWithSingular, 78 mm: relativeTimeWithPlural, 79 h: relativeTimeWithSingular, 80 hh: relativeTimeWithPlural, 81 d: relativeTimeWithSingular, 82 dd: relativeTimeWithPlural, 83 M: relativeTimeWithSingular, 84 MM: relativeTimeWithPlural, 85 y: relativeTimeWithSingular, 86 yy: relativeTimeWithPlural, 87 }, 88 dayOfMonthOrdinalParse: /\d{1,2}\./, 89 ordinal: '%d.', 90 week: { 91 dow: 1, // Monday is the first day of the week. 92 doy: 4, // The week that contains Jan 4th is the first week of the year. 93 }, 94});