me.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. //! moment.js locale configuration
  2. //! locale : Montenegrin [me]
  3. //! author : Miodrag Nikač <miodrag@restartit.me> : https://github.com/miodragnikac
  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. //! moment.js locale configuration
  11. var translator = {
  12. words: {
  13. //Different grammatical cases
  14. ss: ['sekund', 'sekunda', 'sekundi'],
  15. m: ['jedan minut', 'jednog minuta'],
  16. mm: ['minut', 'minuta', 'minuta'],
  17. h: ['jedan sat', 'jednog sata'],
  18. hh: ['sat', 'sata', 'sati'],
  19. dd: ['dan', 'dana', 'dana'],
  20. MM: ['mjesec', 'mjeseca', 'mjeseci'],
  21. yy: ['godina', 'godine', 'godina'],
  22. },
  23. correctGrammaticalCase: function (number, wordKey) {
  24. return number === 1
  25. ? wordKey[0]
  26. : number >= 2 && number <= 4
  27. ? wordKey[1]
  28. : wordKey[2];
  29. },
  30. translate: function (number, withoutSuffix, key) {
  31. var wordKey = translator.words[key];
  32. if (key.length === 1) {
  33. return withoutSuffix ? wordKey[0] : wordKey[1];
  34. } else {
  35. return (
  36. number +
  37. ' ' +
  38. translator.correctGrammaticalCase(number, wordKey)
  39. );
  40. }
  41. },
  42. };
  43. var me = moment.defineLocale('me', {
  44. months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split(
  45. '_'
  46. ),
  47. monthsShort:
  48. 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'),
  49. monthsParseExact: true,
  50. weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split(
  51. '_'
  52. ),
  53. weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
  54. weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
  55. weekdaysParseExact: true,
  56. longDateFormat: {
  57. LT: 'H:mm',
  58. LTS: 'H:mm:ss',
  59. L: 'DD.MM.YYYY',
  60. LL: 'D. MMMM YYYY',
  61. LLL: 'D. MMMM YYYY H:mm',
  62. LLLL: 'dddd, D. MMMM YYYY H:mm',
  63. },
  64. calendar: {
  65. sameDay: '[danas u] LT',
  66. nextDay: '[sjutra u] LT',
  67. nextWeek: function () {
  68. switch (this.day()) {
  69. case 0:
  70. return '[u] [nedjelju] [u] LT';
  71. case 3:
  72. return '[u] [srijedu] [u] LT';
  73. case 6:
  74. return '[u] [subotu] [u] LT';
  75. case 1:
  76. case 2:
  77. case 4:
  78. case 5:
  79. return '[u] dddd [u] LT';
  80. }
  81. },
  82. lastDay: '[juče u] LT',
  83. lastWeek: function () {
  84. var lastWeekDays = [
  85. '[prošle] [nedjelje] [u] LT',
  86. '[prošlog] [ponedjeljka] [u] LT',
  87. '[prošlog] [utorka] [u] LT',
  88. '[prošle] [srijede] [u] LT',
  89. '[prošlog] [četvrtka] [u] LT',
  90. '[prošlog] [petka] [u] LT',
  91. '[prošle] [subote] [u] LT',
  92. ];
  93. return lastWeekDays[this.day()];
  94. },
  95. sameElse: 'L',
  96. },
  97. relativeTime: {
  98. future: 'za %s',
  99. past: 'prije %s',
  100. s: 'nekoliko sekundi',
  101. ss: translator.translate,
  102. m: translator.translate,
  103. mm: translator.translate,
  104. h: translator.translate,
  105. hh: translator.translate,
  106. d: 'dan',
  107. dd: translator.translate,
  108. M: 'mjesec',
  109. MM: translator.translate,
  110. y: 'godinu',
  111. yy: translator.translate,
  112. },
  113. dayOfMonthOrdinalParse: /\d{1,2}\./,
  114. ordinal: '%d.',
  115. week: {
  116. dow: 1, // Monday is the first day of the week.
  117. doy: 7, // The week that contains Jan 7th is the first week of the year.
  118. },
  119. });
  120. return me;
  121. })));