PageRenderTime 43ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/www/lib/moment/src/locale/sk.js

https://gitlab.com/bcchoi/ionic-elastichat
JavaScript | 149 lines | 140 code | 4 blank | 5 comment | 24 complexity | 4ec4604c7a39bdec88f3e70fbb5fa3d6 MD5 | raw file
  1. //! moment.js locale configuration
  2. //! locale : slovak (sk)
  3. //! author : Martin Minka : https://github.com/k2s
  4. //! based on work of petrbela : https://github.com/petrbela
  5. import moment from '../moment';
  6. var months = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'),
  7. monthsShort = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_');
  8. function plural(n) {
  9. return (n > 1) && (n < 5);
  10. }
  11. function translate(number, withoutSuffix, key, isFuture) {
  12. var result = number + ' ';
  13. switch (key) {
  14. case 's': // a few seconds / in a few seconds / a few seconds ago
  15. return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami';
  16. case 'm': // a minute / in a minute / a minute ago
  17. return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou');
  18. case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
  19. if (withoutSuffix || isFuture) {
  20. return result + (plural(number) ? 'minúty' : 'minút');
  21. } else {
  22. return result + 'minútami';
  23. }
  24. break;
  25. case 'h': // an hour / in an hour / an hour ago
  26. return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou');
  27. case 'hh': // 9 hours / in 9 hours / 9 hours ago
  28. if (withoutSuffix || isFuture) {
  29. return result + (plural(number) ? 'hodiny' : 'hodín');
  30. } else {
  31. return result + 'hodinami';
  32. }
  33. break;
  34. case 'd': // a day / in a day / a day ago
  35. return (withoutSuffix || isFuture) ? 'deň' : 'dňom';
  36. case 'dd': // 9 days / in 9 days / 9 days ago
  37. if (withoutSuffix || isFuture) {
  38. return result + (plural(number) ? 'dni' : 'dní');
  39. } else {
  40. return result + 'dňami';
  41. }
  42. break;
  43. case 'M': // a month / in a month / a month ago
  44. return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom';
  45. case 'MM': // 9 months / in 9 months / 9 months ago
  46. if (withoutSuffix || isFuture) {
  47. return result + (plural(number) ? 'mesiace' : 'mesiacov');
  48. } else {
  49. return result + 'mesiacmi';
  50. }
  51. break;
  52. case 'y': // a year / in a year / a year ago
  53. return (withoutSuffix || isFuture) ? 'rok' : 'rokom';
  54. case 'yy': // 9 years / in 9 years / 9 years ago
  55. if (withoutSuffix || isFuture) {
  56. return result + (plural(number) ? 'roky' : 'rokov');
  57. } else {
  58. return result + 'rokmi';
  59. }
  60. break;
  61. }
  62. }
  63. export default moment.defineLocale('sk', {
  64. months : months,
  65. monthsShort : monthsShort,
  66. monthsParse : (function (months, monthsShort) {
  67. var i, _monthsParse = [];
  68. for (i = 0; i < 12; i++) {
  69. // use custom parser to solve problem with July (červenec)
  70. _monthsParse[i] = new RegExp('^' + months[i] + '$|^' + monthsShort[i] + '$', 'i');
  71. }
  72. return _monthsParse;
  73. }(months, monthsShort)),
  74. weekdays : 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'),
  75. weekdaysShort : 'ne_po_ut_st_št_pi_so'.split('_'),
  76. weekdaysMin : 'ne_po_ut_st_št_pi_so'.split('_'),
  77. longDateFormat : {
  78. LT: 'H:mm',
  79. LTS : 'H:mm:ss',
  80. L : 'DD.MM.YYYY',
  81. LL : 'D. MMMM YYYY',
  82. LLL : 'D. MMMM YYYY H:mm',
  83. LLLL : 'dddd D. MMMM YYYY H:mm'
  84. },
  85. calendar : {
  86. sameDay: '[dnes o] LT',
  87. nextDay: '[zajtra o] LT',
  88. nextWeek: function () {
  89. switch (this.day()) {
  90. case 0:
  91. return '[v nedeľu o] LT';
  92. case 1:
  93. case 2:
  94. return '[v] dddd [o] LT';
  95. case 3:
  96. return '[v stredu o] LT';
  97. case 4:
  98. return '[vo štvrtok o] LT';
  99. case 5:
  100. return '[v piatok o] LT';
  101. case 6:
  102. return '[v sobotu o] LT';
  103. }
  104. },
  105. lastDay: '[včera o] LT',
  106. lastWeek: function () {
  107. switch (this.day()) {
  108. case 0:
  109. return '[minulú nedeľu o] LT';
  110. case 1:
  111. case 2:
  112. return '[minulý] dddd [o] LT';
  113. case 3:
  114. return '[minulú stredu o] LT';
  115. case 4:
  116. case 5:
  117. return '[minulý] dddd [o] LT';
  118. case 6:
  119. return '[minulú sobotu o] LT';
  120. }
  121. },
  122. sameElse: 'L'
  123. },
  124. relativeTime : {
  125. future : 'za %s',
  126. past : 'pred %s',
  127. s : translate,
  128. m : translate,
  129. mm : translate,
  130. h : translate,
  131. hh : translate,
  132. d : translate,
  133. dd : translate,
  134. M : translate,
  135. MM : translate,
  136. y : translate,
  137. yy : translate
  138. },
  139. ordinalParse: /\d{1,2}\./,
  140. ordinal : '%d.',
  141. week : {
  142. dow : 1, // Monday is the first day of the week.
  143. doy : 4 // The week that contains Jan 4th is the first week of the year.
  144. }
  145. });