sl.js 6.0 KB

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