sl.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. //! moment.js locale configuration
  2. //! locale : slovenian (sl)
  3. //! author : Robert Sedovšek : https://github.com/sedovsek
  4. ;(function (global, factory) {
  5. typeof exports === 'object' && typeof module !== 'undefined'
  6. && typeof require === 'function' ? factory(require('../moment')) :
  7. typeof define === 'function' && define.amd ? define(['moment'], factory) :
  8. factory(global.moment)
  9. }(this, function (moment) { 'use strict';
  10. function processRelativeTime(number, withoutSuffix, key, isFuture) {
  11. var result = number + ' ';
  12. switch (key) {
  13. case 's':
  14. return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami';
  15. case 'm':
  16. return withoutSuffix ? 'ena minuta' : 'eno minuto';
  17. case 'mm':
  18. if (number === 1) {
  19. result += withoutSuffix ? 'minuta' : 'minuto';
  20. } else if (number === 2) {
  21. result += withoutSuffix || isFuture ? 'minuti' : 'minutama';
  22. } else if (number < 5) {
  23. result += withoutSuffix || isFuture ? 'minute' : 'minutami';
  24. } else {
  25. result += withoutSuffix || isFuture ? 'minut' : 'minutami';
  26. }
  27. return result;
  28. case 'h':
  29. return withoutSuffix ? 'ena ura' : 'eno uro';
  30. case 'hh':
  31. if (number === 1) {
  32. result += withoutSuffix ? 'ura' : 'uro';
  33. } else if (number === 2) {
  34. result += withoutSuffix || isFuture ? 'uri' : 'urama';
  35. } else if (number < 5) {
  36. result += withoutSuffix || isFuture ? 'ure' : 'urami';
  37. } else {
  38. result += withoutSuffix || isFuture ? 'ur' : 'urami';
  39. }
  40. return result;
  41. case 'd':
  42. return withoutSuffix || isFuture ? 'en dan' : 'enim dnem';
  43. case 'dd':
  44. if (number === 1) {
  45. result += withoutSuffix || isFuture ? 'dan' : 'dnem';
  46. } else if (number === 2) {
  47. result += withoutSuffix || isFuture ? 'dni' : 'dnevoma';
  48. } else {
  49. result += withoutSuffix || isFuture ? 'dni' : 'dnevi';
  50. }
  51. return result;
  52. case 'M':
  53. return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem';
  54. case 'MM':
  55. if (number === 1) {
  56. result += withoutSuffix || isFuture ? 'mesec' : 'mesecem';
  57. } else if (number === 2) {
  58. result += withoutSuffix || isFuture ? 'meseca' : 'mesecema';
  59. } else if (number < 5) {
  60. result += withoutSuffix || isFuture ? 'mesece' : 'meseci';
  61. } else {
  62. result += withoutSuffix || isFuture ? 'mesecev' : 'meseci';
  63. }
  64. return result;
  65. case 'y':
  66. return withoutSuffix || isFuture ? 'eno leto' : 'enim letom';
  67. case 'yy':
  68. if (number === 1) {
  69. result += withoutSuffix || isFuture ? 'leto' : 'letom';
  70. } else if (number === 2) {
  71. result += withoutSuffix || isFuture ? 'leti' : 'letoma';
  72. } else if (number < 5) {
  73. result += withoutSuffix || isFuture ? 'leta' : 'leti';
  74. } else {
  75. result += withoutSuffix || isFuture ? 'let' : 'leti';
  76. }
  77. return result;
  78. }
  79. }
  80. var sl = moment.defineLocale('sl', {
  81. months : 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split('_'),
  82. monthsShort : 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split('_'),
  83. monthsParseExact: true,
  84. weekdays : 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'),
  85. weekdaysShort : 'ned._pon._tor._sre._čet._pet._sob.'.split('_'),
  86. weekdaysMin : 'ne_po_to_sr_če_pe_so'.split('_'),
  87. weekdaysParseExact : true,
  88. longDateFormat : {
  89. LT : 'H:mm',
  90. LTS : 'H:mm:ss',
  91. L : 'DD. MM. YYYY',
  92. LL : 'D. MMMM YYYY',
  93. LLL : 'D. MMMM YYYY H:mm',
  94. LLLL : 'dddd, D. MMMM YYYY H:mm'
  95. },
  96. calendar : {
  97. sameDay : '[danes ob] LT',
  98. nextDay : '[jutri ob] LT',
  99. nextWeek : function () {
  100. switch (this.day()) {
  101. case 0:
  102. return '[v] [nedeljo] [ob] LT';
  103. case 3:
  104. return '[v] [sredo] [ob] LT';
  105. case 6:
  106. return '[v] [soboto] [ob] LT';
  107. case 1:
  108. case 2:
  109. case 4:
  110. case 5:
  111. return '[v] dddd [ob] LT';
  112. }
  113. },
  114. lastDay : '[včeraj ob] LT',
  115. lastWeek : function () {
  116. switch (this.day()) {
  117. case 0:
  118. return '[prejšnjo] [nedeljo] [ob] LT';
  119. case 3:
  120. return '[prejšnjo] [sredo] [ob] LT';
  121. case 6:
  122. return '[prejšnjo] [soboto] [ob] LT';
  123. case 1:
  124. case 2:
  125. case 4:
  126. case 5:
  127. return '[prejšnji] dddd [ob] LT';
  128. }
  129. },
  130. sameElse : 'L'
  131. },
  132. relativeTime : {
  133. future : 'čez %s',
  134. past : 'pred %s',
  135. s : processRelativeTime,
  136. m : processRelativeTime,
  137. mm : processRelativeTime,
  138. h : processRelativeTime,
  139. hh : processRelativeTime,
  140. d : processRelativeTime,
  141. dd : processRelativeTime,
  142. M : processRelativeTime,
  143. MM : processRelativeTime,
  144. y : processRelativeTime,
  145. yy : processRelativeTime
  146. },
  147. ordinalParse: /\d{1,2}\./,
  148. ordinal : '%d.',
  149. week : {
  150. dow : 1, // Monday is the first day of the week.
  151. doy : 7 // The week that contains Jan 1st is the first week of the year.
  152. }
  153. });
  154. return sl;
  155. }));