me.js 3.6KB

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