bs.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. //! moment.js locale configuration
  2. //! locale : Bosnian [bs]
  3. //! author : Nedim Cholich : https://github.com/frontyard
  4. //! author : Rasid Redzic : https://github.com/rasidre
  5. //! based on (hr) translation by Bojan Marković
  6. import moment from '../moment';
  7. function processRelativeTime(number, withoutSuffix, key, isFuture) {
  8. switch (key) {
  9. case 'm':
  10. return withoutSuffix
  11. ? 'jedna minuta'
  12. : isFuture
  13. ? 'jednu minutu'
  14. : 'jedne minute';
  15. }
  16. }
  17. function translate(number, withoutSuffix, key) {
  18. var result = number + ' ';
  19. switch (key) {
  20. case 'ss':
  21. if (number === 1) {
  22. result += 'sekunda';
  23. } else if (number === 2 || number === 3 || number === 4) {
  24. result += 'sekunde';
  25. } else {
  26. result += 'sekundi';
  27. }
  28. return result;
  29. case 'mm':
  30. if (number === 1) {
  31. result += 'minuta';
  32. } else if (number === 2 || number === 3 || number === 4) {
  33. result += 'minute';
  34. } else {
  35. result += 'minuta';
  36. }
  37. return result;
  38. case 'h':
  39. return withoutSuffix ? 'jedan sat' : 'jedan sat';
  40. case 'hh':
  41. if (number === 1) {
  42. result += 'sat';
  43. } else if (number === 2 || number === 3 || number === 4) {
  44. result += 'sata';
  45. } else {
  46. result += 'sati';
  47. }
  48. return result;
  49. case 'dd':
  50. if (number === 1) {
  51. result += 'dan';
  52. } else {
  53. result += 'dana';
  54. }
  55. return result;
  56. case 'MM':
  57. if (number === 1) {
  58. result += 'mjesec';
  59. } else if (number === 2 || number === 3 || number === 4) {
  60. result += 'mjeseca';
  61. } else {
  62. result += 'mjeseci';
  63. }
  64. return result;
  65. case 'yy':
  66. if (number === 1) {
  67. result += 'godina';
  68. } else if (number === 2 || number === 3 || number === 4) {
  69. result += 'godine';
  70. } else {
  71. result += 'godina';
  72. }
  73. return result;
  74. }
  75. }
  76. export default moment.defineLocale('bs', {
  77. months: 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split(
  78. '_'
  79. ),
  80. monthsShort:
  81. 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split(
  82. '_'
  83. ),
  84. monthsParseExact: true,
  85. weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split(
  86. '_'
  87. ),
  88. weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
  89. weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
  90. weekdaysParseExact: true,
  91. longDateFormat: {
  92. LT: 'H:mm',
  93. LTS: 'H:mm:ss',
  94. L: 'DD.MM.YYYY',
  95. LL: 'D. MMMM YYYY',
  96. LLL: 'D. MMMM YYYY H:mm',
  97. LLLL: 'dddd, D. MMMM YYYY H:mm',
  98. },
  99. calendar: {
  100. sameDay: '[danas u] LT',
  101. nextDay: '[sutra u] LT',
  102. nextWeek: function () {
  103. switch (this.day()) {
  104. case 0:
  105. return '[u] [nedjelju] [u] LT';
  106. case 3:
  107. return '[u] [srijedu] [u] LT';
  108. case 6:
  109. return '[u] [subotu] [u] LT';
  110. case 1:
  111. case 2:
  112. case 4:
  113. case 5:
  114. return '[u] dddd [u] LT';
  115. }
  116. },
  117. lastDay: '[jučer u] LT',
  118. lastWeek: function () {
  119. switch (this.day()) {
  120. case 0:
  121. case 3:
  122. return '[prošlu] dddd [u] LT';
  123. case 6:
  124. return '[prošle] [subote] [u] LT';
  125. case 1:
  126. case 2:
  127. case 4:
  128. case 5:
  129. return '[prošli] dddd [u] LT';
  130. }
  131. },
  132. sameElse: 'L',
  133. },
  134. relativeTime: {
  135. future: 'za %s',
  136. past: 'prije %s',
  137. s: 'par sekundi',
  138. ss: translate,
  139. m: processRelativeTime,
  140. mm: translate,
  141. h: translate,
  142. hh: translate,
  143. d: 'dan',
  144. dd: translate,
  145. M: 'mjesec',
  146. MM: translate,
  147. y: 'godinu',
  148. yy: translate,
  149. },
  150. dayOfMonthOrdinalParse: /\d{1,2}\./,
  151. ordinal: '%d.',
  152. week: {
  153. dow: 1, // Monday is the first day of the week.
  154. doy: 7, // The week that contains Jan 7th is the first week of the year.
  155. },
  156. });