ac9b821f68f8da267fba273006a2517f06e1fd0ca7ee96363c1cdd551d9465931bbf69e7f36e1ab7b6a4e56e97c01b9557396c3ef43d18672e72f2f3df729a 3.3 KB

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