pl.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. //! moment.js locale configuration
  2. //! locale : Polish [pl]
  3. //! author : Rafal Hirsz : https://github.com/evoL
  4. ;(function (global, factory) {
  5. typeof exports === 'object' && typeof module !== 'undefined'
  6. && typeof require === 'function' ? factory(require('../moment')) :
  7. typeof define === 'function' && define.amd ? define(['../moment'], factory) :
  8. factory(global.moment)
  9. }(this, (function (moment) { 'use strict';
  10. var monthsNominative = 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split('_');
  11. var monthsSubjective = 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split('_');
  12. function plural(n) {
  13. return (n % 10 < 5) && (n % 10 > 1) && ((~~(n / 10) % 10) !== 1);
  14. }
  15. function translate(number, withoutSuffix, key) {
  16. var result = number + ' ';
  17. switch (key) {
  18. case 'ss':
  19. return result + (plural(number) ? 'sekundy' : 'sekund');
  20. case 'm':
  21. return withoutSuffix ? 'minuta' : 'minutę';
  22. case 'mm':
  23. return result + (plural(number) ? 'minuty' : 'minut');
  24. case 'h':
  25. return withoutSuffix ? 'godzina' : 'godzinę';
  26. case 'hh':
  27. return result + (plural(number) ? 'godziny' : 'godzin');
  28. case 'MM':
  29. return result + (plural(number) ? 'miesiące' : 'miesięcy');
  30. case 'yy':
  31. return result + (plural(number) ? 'lata' : 'lat');
  32. }
  33. }
  34. var pl = moment.defineLocale('pl', {
  35. months : function (momentToFormat, format) {
  36. if (!momentToFormat) {
  37. return monthsNominative;
  38. } else if (format === '') {
  39. // Hack: if format empty we know this is used to generate
  40. // RegExp by moment. Give then back both valid forms of months
  41. // in RegExp ready format.
  42. return '(' + monthsSubjective[momentToFormat.month()] + '|' + monthsNominative[momentToFormat.month()] + ')';
  43. } else if (/D MMMM/.test(format)) {
  44. return monthsSubjective[momentToFormat.month()];
  45. } else {
  46. return monthsNominative[momentToFormat.month()];
  47. }
  48. },
  49. monthsShort : 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'),
  50. weekdays : 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split('_'),
  51. weekdaysShort : 'ndz_pon_wt_śr_czw_pt_sob'.split('_'),
  52. weekdaysMin : 'Nd_Pn_Wt_Śr_Cz_Pt_So'.split('_'),
  53. longDateFormat : {
  54. LT : 'HH:mm',
  55. LTS : 'HH:mm:ss',
  56. L : 'DD.MM.YYYY',
  57. LL : 'D MMMM YYYY',
  58. LLL : 'D MMMM YYYY HH:mm',
  59. LLLL : 'dddd, D MMMM YYYY HH:mm'
  60. },
  61. calendar : {
  62. sameDay: '[Dziś o] LT',
  63. nextDay: '[Jutro o] LT',
  64. nextWeek: function () {
  65. switch (this.day()) {
  66. case 0:
  67. return '[W niedzielę o] LT';
  68. case 2:
  69. return '[We wtorek o] LT';
  70. case 3:
  71. return '[W środę o] LT';
  72. case 6:
  73. return '[W sobotę o] LT';
  74. default:
  75. return '[W] dddd [o] LT';
  76. }
  77. },
  78. lastDay: '[Wczoraj o] LT',
  79. lastWeek: function () {
  80. switch (this.day()) {
  81. case 0:
  82. return '[W zeszłą niedzielę o] LT';
  83. case 3:
  84. return '[W zeszłą środę o] LT';
  85. case 6:
  86. return '[W zeszłą sobotę o] LT';
  87. default:
  88. return '[W zeszły] dddd [o] LT';
  89. }
  90. },
  91. sameElse: 'L'
  92. },
  93. relativeTime : {
  94. future : 'za %s',
  95. past : '%s temu',
  96. s : 'kilka sekund',
  97. ss : translate,
  98. m : translate,
  99. mm : translate,
  100. h : translate,
  101. hh : translate,
  102. d : '1 dzień',
  103. dd : '%d dni',
  104. M : 'miesiąc',
  105. MM : translate,
  106. y : 'rok',
  107. yy : translate
  108. },
  109. dayOfMonthOrdinalParse: /\d{1,2}\./,
  110. ordinal : '%d.',
  111. week : {
  112. dow : 1, // Monday is the first day of the week.
  113. doy : 4 // The week that contains Jan 4th is the first week of the year.
  114. }
  115. });
  116. return pl;
  117. })));