me.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split(
  48. '_'
  49. ),
  50. monthsParseExact: true,
  51. weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split(
  52. '_'
  53. ),
  54. weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
  55. weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
  56. weekdaysParseExact: true,
  57. longDateFormat: {
  58. LT: 'H:mm',
  59. LTS: 'H:mm:ss',
  60. L: 'DD.MM.YYYY',
  61. LL: 'D. MMMM YYYY',
  62. LLL: 'D. MMMM YYYY H:mm',
  63. LLLL: 'dddd, D. MMMM YYYY H:mm',
  64. },
  65. calendar: {
  66. sameDay: '[danas u] LT',
  67. nextDay: '[sjutra u] LT',
  68. nextWeek: function () {
  69. switch (this.day()) {
  70. case 0:
  71. return '[u] [nedjelju] [u] LT';
  72. case 3:
  73. return '[u] [srijedu] [u] LT';
  74. case 6:
  75. return '[u] [subotu] [u] LT';
  76. case 1:
  77. case 2:
  78. case 4:
  79. case 5:
  80. return '[u] dddd [u] LT';
  81. }
  82. },
  83. lastDay: '[juče u] LT',
  84. lastWeek: function () {
  85. var lastWeekDays = [
  86. '[prošle] [nedjelje] [u] LT',
  87. '[prošlog] [ponedjeljka] [u] LT',
  88. '[prošlog] [utorka] [u] LT',
  89. '[prošle] [srijede] [u] LT',
  90. '[prošlog] [četvrtka] [u] LT',
  91. '[prošlog] [petka] [u] LT',
  92. '[prošle] [subote] [u] LT',
  93. ];
  94. return lastWeekDays[this.day()];
  95. },
  96. sameElse: 'L',
  97. },
  98. relativeTime: {
  99. future: 'za %s',
  100. past: 'prije %s',
  101. s: 'nekoliko sekundi',
  102. ss: translator.translate,
  103. m: translator.translate,
  104. mm: translator.translate,
  105. h: translator.translate,
  106. hh: translator.translate,
  107. d: 'dan',
  108. dd: translator.translate,
  109. M: 'mjesec',
  110. MM: translator.translate,
  111. y: 'godinu',
  112. yy: translator.translate,
  113. },
  114. dayOfMonthOrdinalParse: /\d{1,2}\./,
  115. ordinal: '%d.',
  116. week: {
  117. dow: 1, // Monday is the first day of the week.
  118. doy: 7, // The week that contains Jan 7th is the first week of the year.
  119. },
  120. });
  121. return me;
  122. })));