You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
4.1 KiB

  1. //! moment.js locale configuration
  2. //! locale : Serbian-latin (sr)
  3. //! author : Milan Janačković<milanjanackovic@gmail.com> : https://github.com/milan-j
  4. (function (global, factory) {
  5. typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../moment')) :
  6. typeof define === 'function' && define.amd ? define(['moment'], factory) :
  7. factory(global.moment)
  8. }(this, function (moment) { 'use strict';
  9. var translator = {
  10. words: { //Different grammatical cases
  11. m: ['jedan minut', 'jedne minute'],
  12. mm: ['minut', 'minute', 'minuta'],
  13. h: ['jedan sat', 'jednog sata'],
  14. hh: ['sat', 'sata', 'sati'],
  15. dd: ['dan', 'dana', 'dana'],
  16. MM: ['mesec', 'meseca', 'meseci'],
  17. yy: ['godina', 'godine', 'godina']
  18. },
  19. correctGrammaticalCase: function (number, wordKey) {
  20. return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]);
  21. },
  22. translate: function (number, withoutSuffix, key) {
  23. var wordKey = translator.words[key];
  24. if (key.length === 1) {
  25. return withoutSuffix ? wordKey[0] : wordKey[1];
  26. } else {
  27. return number + ' ' + translator.correctGrammaticalCase(number, wordKey);
  28. }
  29. }
  30. };
  31. var sr = moment.defineLocale('sr', {
  32. months: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'],
  33. monthsShort: ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'],
  34. weekdays: ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'],
  35. weekdaysShort: ['ned.', 'pon.', 'uto.', 'sre.', 'čet.', 'pet.', 'sub.'],
  36. weekdaysMin: ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'],
  37. longDateFormat: {
  38. LT: 'H:mm',
  39. LTS : 'LT:ss',
  40. L: 'DD. MM. YYYY',
  41. LL: 'D. MMMM YYYY',
  42. LLL: 'D. MMMM YYYY LT',
  43. LLLL: 'dddd, D. MMMM YYYY LT'
  44. },
  45. calendar: {
  46. sameDay: '[danas u] LT',
  47. nextDay: '[sutra u] LT',
  48. nextWeek: function () {
  49. switch (this.day()) {
  50. case 0:
  51. return '[u] [nedelju] [u] LT';
  52. case 3:
  53. return '[u] [sredu] [u] LT';
  54. case 6:
  55. return '[u] [subotu] [u] LT';
  56. case 1:
  57. case 2:
  58. case 4:
  59. case 5:
  60. return '[u] dddd [u] LT';
  61. }
  62. },
  63. lastDay : '[juče u] LT',
  64. lastWeek : function () {
  65. var lastWeekDays = [
  66. '[prošle] [nedelje] [u] LT',
  67. '[prošlog] [ponedeljka] [u] LT',
  68. '[prošlog] [utorka] [u] LT',
  69. '[prošle] [srede] [u] LT',
  70. '[prošlog] [četvrtka] [u] LT',
  71. '[prošlog] [petka] [u] LT',
  72. '[prošle] [subote] [u] LT'
  73. ];
  74. return lastWeekDays[this.day()];
  75. },
  76. sameElse : 'L'
  77. },
  78. relativeTime : {
  79. future : 'za %s',
  80. past : 'pre %s',
  81. s : 'nekoliko sekundi',
  82. m : translator.translate,
  83. mm : translator.translate,
  84. h : translator.translate,
  85. hh : translator.translate,
  86. d : 'dan',
  87. dd : translator.translate,
  88. M : 'mesec',
  89. MM : translator.translate,
  90. y : 'godinu',
  91. yy : translator.translate
  92. },
  93. ordinalParse: /\d{1,2}\./,
  94. ordinal : '%d.',
  95. week : {
  96. dow : 1, // Monday is the first day of the week.
  97. doy : 7 // The week that contains Jan 1st is the first week of the year.
  98. }
  99. });
  100. return sr;
  101. }));