sr.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. //! moment.js locale configuration
  2. //! locale : Serbian [sr]
  3. //! author : Milan Janačković<milanjanackovic@gmail.com> : https://github.com/milan-j
  4. //! author : Stefan Crnjaković <stefan@hotmail.rs> : https://github.com/crnjakovic
  5. ;(function (global, factory) {
  6. typeof exports === 'object' && typeof module !== 'undefined'
  7. && typeof require === 'function' ? factory(require('../moment')) :
  8. typeof define === 'function' && define.amd ? define(['../moment'], factory) :
  9. factory(global.moment)
  10. }(this, (function (moment) { 'use strict';
  11. //! moment.js locale configuration
  12. var translator = {
  13. words: {
  14. //Different grammatical cases
  15. ss: ['sekunda', 'sekunde', 'sekundi'],
  16. m: ['jedan minut', 'jedne minute'],
  17. mm: ['minut', 'minute', 'minuta'],
  18. h: ['jedan sat', 'jednog sata'],
  19. hh: ['sat', 'sata', 'sati'],
  20. dd: ['dan', 'dana', 'dana'],
  21. MM: ['mesec', 'meseca', 'meseci'],
  22. yy: ['godina', 'godine', 'godina'],
  23. },
  24. correctGrammaticalCase: function (number, wordKey) {
  25. return number === 1
  26. ? wordKey[0]
  27. : number >= 2 && number <= 4
  28. ? wordKey[1]
  29. : wordKey[2];
  30. },
  31. translate: function (number, withoutSuffix, key) {
  32. var wordKey = translator.words[key];
  33. if (key.length === 1) {
  34. return withoutSuffix ? wordKey[0] : wordKey[1];
  35. } else {
  36. return (
  37. number +
  38. ' ' +
  39. translator.correctGrammaticalCase(number, wordKey)
  40. );
  41. }
  42. },
  43. };
  44. var sr = moment.defineLocale('sr', {
  45. months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split(
  46. '_'
  47. ),
  48. monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split(
  49. '_'
  50. ),
  51. monthsParseExact: true,
  52. weekdays: 'nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota'.split(
  53. '_'
  54. ),
  55. weekdaysShort: 'ned._pon._uto._sre._čet._pet._sub.'.split('_'),
  56. weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
  57. weekdaysParseExact: true,
  58. longDateFormat: {
  59. LT: 'H:mm',
  60. LTS: 'H:mm:ss',
  61. L: 'D. M. YYYY.',
  62. LL: 'D. MMMM YYYY.',
  63. LLL: 'D. MMMM YYYY. H:mm',
  64. LLLL: 'dddd, D. MMMM YYYY. H:mm',
  65. },
  66. calendar: {
  67. sameDay: '[danas u] LT',
  68. nextDay: '[sutra u] LT',
  69. nextWeek: function () {
  70. switch (this.day()) {
  71. case 0:
  72. return '[u] [nedelju] [u] LT';
  73. case 3:
  74. return '[u] [sredu] [u] LT';
  75. case 6:
  76. return '[u] [subotu] [u] LT';
  77. case 1:
  78. case 2:
  79. case 4:
  80. case 5:
  81. return '[u] dddd [u] LT';
  82. }
  83. },
  84. lastDay: '[juče u] LT',
  85. lastWeek: function () {
  86. var lastWeekDays = [
  87. '[prošle] [nedelje] [u] LT',
  88. '[prošlog] [ponedeljka] [u] LT',
  89. '[prošlog] [utorka] [u] LT',
  90. '[prošle] [srede] [u] LT',
  91. '[prošlog] [četvrtka] [u] LT',
  92. '[prošlog] [petka] [u] LT',
  93. '[prošle] [subote] [u] LT',
  94. ];
  95. return lastWeekDays[this.day()];
  96. },
  97. sameElse: 'L',
  98. },
  99. relativeTime: {
  100. future: 'za %s',
  101. past: 'pre %s',
  102. s: 'nekoliko sekundi',
  103. ss: translator.translate,
  104. m: translator.translate,
  105. mm: translator.translate,
  106. h: translator.translate,
  107. hh: translator.translate,
  108. d: 'dan',
  109. dd: translator.translate,
  110. M: 'mesec',
  111. MM: translator.translate,
  112. y: 'godinu',
  113. yy: translator.translate,
  114. },
  115. dayOfMonthOrdinalParse: /\d{1,2}\./,
  116. ordinal: '%d.',
  117. week: {
  118. dow: 1, // Monday is the first day of the week.
  119. doy: 7, // The week that contains Jan 7th is the first week of the year.
  120. },
  121. });
  122. return sr;
  123. })));