sl.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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: 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split(
  93. '_'
  94. ),
  95. monthsParseExact: true,
  96. weekdays: 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'),
  97. weekdaysShort: 'ned._pon._tor._sre._čet._pet._sob.'.split('_'),
  98. weekdaysMin: 'ne_po_to_sr_če_pe_so'.split('_'),
  99. weekdaysParseExact: true,
  100. longDateFormat: {
  101. LT: 'H:mm',
  102. LTS: 'H:mm:ss',
  103. L: 'DD. MM. YYYY',
  104. LL: 'D. MMMM YYYY',
  105. LLL: 'D. MMMM YYYY H:mm',
  106. LLLL: 'dddd, D. MMMM YYYY H:mm',
  107. },
  108. calendar: {
  109. sameDay: '[danes ob] LT',
  110. nextDay: '[jutri ob] LT',
  111. nextWeek: function () {
  112. switch (this.day()) {
  113. case 0:
  114. return '[v] [nedeljo] [ob] LT';
  115. case 3:
  116. return '[v] [sredo] [ob] LT';
  117. case 6:
  118. return '[v] [soboto] [ob] LT';
  119. case 1:
  120. case 2:
  121. case 4:
  122. case 5:
  123. return '[v] dddd [ob] LT';
  124. }
  125. },
  126. lastDay: '[včeraj ob] LT',
  127. lastWeek: function () {
  128. switch (this.day()) {
  129. case 0:
  130. return '[prejšnjo] [nedeljo] [ob] LT';
  131. case 3:
  132. return '[prejšnjo] [sredo] [ob] LT';
  133. case 6:
  134. return '[prejšnjo] [soboto] [ob] LT';
  135. case 1:
  136. case 2:
  137. case 4:
  138. case 5:
  139. return '[prejšnji] dddd [ob] LT';
  140. }
  141. },
  142. sameElse: 'L',
  143. },
  144. relativeTime: {
  145. future: 'čez %s',
  146. past: 'pred %s',
  147. s: processRelativeTime,
  148. ss: processRelativeTime,
  149. m: processRelativeTime,
  150. mm: processRelativeTime,
  151. h: processRelativeTime,
  152. hh: processRelativeTime,
  153. d: processRelativeTime,
  154. dd: processRelativeTime,
  155. M: processRelativeTime,
  156. MM: processRelativeTime,
  157. y: processRelativeTime,
  158. yy: processRelativeTime,
  159. },
  160. dayOfMonthOrdinalParse: /\d{1,2}\./,
  161. ordinal: '%d.',
  162. week: {
  163. dow: 1, // Monday is the first day of the week.
  164. doy: 7, // The week that contains Jan 7th is the first week of the year.
  165. },
  166. });