sl.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. // Slovenian [sl]
  2. import dayjs from '../index';
  3. function dual(n) {
  4. return n % 100 == 2; // eslint-disable-line
  5. }
  6. function threeFour(n) {
  7. return n % 100 == 3 || n % 100 == 4; // eslint-disable-line
  8. }
  9. /* eslint-disable */
  10. function translate(number, withoutSuffix, key, isFuture) {
  11. var result = number + " ";
  12. switch (key) {
  13. case 's':
  14. // a few seconds / in a few seconds / a few seconds ago
  15. return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami';
  16. case 'm':
  17. // a minute / in a minute / a minute ago
  18. return withoutSuffix ? 'ena minuta' : 'eno minuto';
  19. case 'mm':
  20. // 9 minutes / in 9 minutes / 9 minutes ago
  21. if (dual(number)) {
  22. return result + (withoutSuffix || isFuture ? 'minuti' : 'minutama');
  23. }
  24. if (threeFour(number)) {
  25. return result + (withoutSuffix || isFuture ? 'minute' : 'minutami');
  26. }
  27. return result + (withoutSuffix || isFuture ? 'minut' : 'minutami');
  28. case 'h':
  29. // an hour / in an hour / an hour ago
  30. return withoutSuffix ? 'ena ura' : isFuture ? 'eno uro' : 'eno uro';
  31. case 'hh':
  32. // 9 hours / in 9 hours / 9 hours ago
  33. if (dual(number)) {
  34. return result + (withoutSuffix || isFuture ? 'uri' : 'urama');
  35. }
  36. if (threeFour(number)) {
  37. return result + (withoutSuffix || isFuture ? 'ure' : 'urami');
  38. }
  39. return result + (withoutSuffix || isFuture ? 'ur' : 'urami');
  40. case 'd':
  41. // a day / in a day / a day ago
  42. return withoutSuffix || isFuture ? 'en dan' : 'enim dnem';
  43. case 'dd':
  44. // 9 days / in 9 days / 9 days ago
  45. if (dual(number)) {
  46. return result + (withoutSuffix || isFuture ? 'dneva' : 'dnevoma');
  47. }
  48. return result + (withoutSuffix || isFuture ? 'dni' : 'dnevi');
  49. case 'M':
  50. // a month / in a month / a month ago
  51. return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem';
  52. case 'MM':
  53. // 9 months / in 9 months / 9 months ago
  54. if (dual(number)) {
  55. // 2 minutes / in 2 minutes
  56. return result + (withoutSuffix || isFuture ? 'meseca' : 'mesecema');
  57. }
  58. if (threeFour(number)) {
  59. return result + (withoutSuffix || isFuture ? 'mesece' : 'meseci');
  60. }
  61. return result + (withoutSuffix || isFuture ? 'mesecev' : 'meseci');
  62. case 'y':
  63. // a year / in a year / a year ago
  64. return withoutSuffix || isFuture ? 'eno leto' : 'enim letom';
  65. case 'yy':
  66. // 9 years / in 9 years / 9 years ago
  67. if (dual(number)) {
  68. // 2 minutes / in 2 minutes
  69. return result + (withoutSuffix || isFuture ? 'leti' : 'letoma');
  70. }
  71. if (threeFour(number)) {
  72. return result + (withoutSuffix || isFuture ? 'leta' : 'leti');
  73. }
  74. return result + (withoutSuffix || isFuture ? 'let' : 'leti');
  75. }
  76. }
  77. /* eslint-enable */
  78. var locale = {
  79. name: 'sl',
  80. weekdays: 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'),
  81. months: 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split('_'),
  82. weekStart: 1,
  83. weekdaysShort: 'ned._pon._tor._sre._čet._pet._sob.'.split('_'),
  84. monthsShort: 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split('_'),
  85. weekdaysMin: 'ne_po_to_sr_če_pe_so'.split('_'),
  86. ordinal: function ordinal(n) {
  87. return n + ".";
  88. },
  89. formats: {
  90. LT: 'H:mm',
  91. LTS: 'H:mm:ss',
  92. L: 'DD.MM.YYYY',
  93. LL: 'D. MMMM YYYY',
  94. LLL: 'D. MMMM YYYY H:mm',
  95. LLLL: 'dddd, D. MMMM YYYY H:mm',
  96. l: 'D. M. YYYY'
  97. },
  98. relativeTime: {
  99. future: 'čez %s',
  100. past: 'pred %s',
  101. s: translate,
  102. m: translate,
  103. mm: translate,
  104. h: translate,
  105. hh: translate,
  106. d: translate,
  107. dd: translate,
  108. M: translate,
  109. MM: translate,
  110. y: translate,
  111. yy: translate
  112. }
  113. };
  114. dayjs.locale(locale, null, true);
  115. export default locale;