lv.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //! moment.js locale configuration
  2. ;(function (global, factory) {
  3. typeof exports === 'object' && typeof module !== 'undefined'
  4. && typeof require === 'function' ? factory(require('../moment')) :
  5. typeof define === 'function' && define.amd ? define(['../moment'], factory) :
  6. factory(global.moment)
  7. }(this, (function (moment) { 'use strict';
  8. var 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. */
  24. function 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. }
  34. function relativeTimeWithPlural(number, withoutSuffix, key) {
  35. return number + ' ' + format(units[key], number, withoutSuffix);
  36. }
  37. function relativeTimeWithSingular(number, withoutSuffix, key) {
  38. return format(units[key], number, withoutSuffix);
  39. }
  40. function relativeSeconds(number, withoutSuffix) {
  41. return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm';
  42. }
  43. var lv = moment.defineLocale('lv', {
  44. months : 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split('_'),
  45. monthsShort : 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'),
  46. weekdays : 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split('_'),
  47. weekdaysShort : 'Sv_P_O_T_C_Pk_S'.split('_'),
  48. weekdaysMin : 'Sv_P_O_T_C_Pk_S'.split('_'),
  49. weekdaysParseExact : true,
  50. longDateFormat : {
  51. LT : 'HH:mm',
  52. LTS : 'HH:mm:ss',
  53. L : 'DD.MM.YYYY.',
  54. LL : 'YYYY. [gada] D. MMMM',
  55. LLL : 'YYYY. [gada] D. MMMM, HH:mm',
  56. LLLL : 'YYYY. [gada] D. MMMM, dddd, HH:mm'
  57. },
  58. calendar : {
  59. sameDay : '[Šodien pulksten] LT',
  60. nextDay : '[Rīt pulksten] LT',
  61. nextWeek : 'dddd [pulksten] LT',
  62. lastDay : '[Vakar pulksten] LT',
  63. lastWeek : '[Pagājušā] dddd [pulksten] LT',
  64. sameElse : 'L'
  65. },
  66. relativeTime : {
  67. future : 'pēc %s',
  68. past : 'pirms %s',
  69. s : relativeSeconds,
  70. ss : relativeTimeWithPlural,
  71. m : relativeTimeWithSingular,
  72. mm : relativeTimeWithPlural,
  73. h : relativeTimeWithSingular,
  74. hh : relativeTimeWithPlural,
  75. d : relativeTimeWithSingular,
  76. dd : relativeTimeWithPlural,
  77. M : relativeTimeWithSingular,
  78. MM : relativeTimeWithPlural,
  79. y : relativeTimeWithSingular,
  80. yy : relativeTimeWithPlural
  81. },
  82. dayOfMonthOrdinalParse: /\d{1,2}\./,
  83. ordinal : '%d.',
  84. week : {
  85. dow : 1, // Monday is the first day of the week.
  86. doy : 4 // The week that contains Jan 4th is the first week of the year.
  87. }
  88. });
  89. return lv;
  90. })));