me.js 3.6 KB

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