sk.php
5.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Philippe Vaucher
* - Martin Suja
* - Tsutomu Kuroda
* - tjku
* - Max Melentiev
* - Juanito Fatas
* - Ivan Stana
* - Akira Matsuda
* - Christopher Dell
* - James McKinney
* - Enrique Vidal
* - Simone Carletti
* - Aaron Patterson
* - Jozef Fulop
* - Nicolás Hock Isaza
* - Tom Hughes
* - Simon Hürlimann (CyT)
* - jofi
* - Jakub ADAMEC
* - Marek Adamický
* - AlterwebStudio
*/
use Carbon\CarbonInterface;
$fromNow = function ($time) {
return 'o '.strtr($time, [
'hodina' => 'hodinu',
'minúta' => 'minútu',
'sekunda' => 'sekundu',
]);
};
$ago = function ($time) {
$replacements = [
'/\bhodina\b/' => 'hodinou',
'/\bminúta\b/' => 'minútou',
'/\bsekunda\b/' => 'sekundou',
'/\bdeň\b/u' => 'dňom',
'/\btýždeň\b/u' => 'týždňom',
'/\bmesiac\b/' => 'mesiacom',
'/\brok\b/' => 'rokom',
];
$replacementsPlural = [
'/\bhodiny\b/' => 'hodinami',
'/\bminúty\b/' => 'minútami',
'/\bsekundy\b/' => 'sekundami',
'/\bdni\b/' => 'dňami',
'/\btýždne\b/' => 'týždňami',
'/\bmesiace\b/' => 'mesiacmi',
'/\broky\b/' => 'rokmi',
];
foreach ($replacements + $replacementsPlural as $pattern => $replacement) {
$time = preg_replace($pattern, $replacement, $time);
}
return "pred $time";
};
return [
'year' => ':count rok|:count roky|:count rokov',
'a_year' => 'rok|:count roky|:count rokov',
'y' => ':count r',
'month' => ':count mesiac|:count mesiace|:count mesiacov',
'a_month' => 'mesiac|:count mesiace|:count mesiacov',
'm' => ':count m',
'week' => ':count týždeň|:count týždne|:count týždňov',
'a_week' => 'týždeň|:count týždne|:count týždňov',
'w' => ':count t',
'day' => ':count deň|:count dni|:count dní',
'a_day' => 'deň|:count dni|:count dní',
'd' => ':count d',
'hour' => ':count hodina|:count hodiny|:count hodín',
'a_hour' => 'hodina|:count hodiny|:count hodín',
'h' => ':count h',
'minute' => ':count minúta|:count minúty|:count minút',
'a_minute' => 'minúta|:count minúty|:count minút',
'min' => ':count min',
'second' => ':count sekunda|:count sekundy|:count sekúnd',
'a_second' => 'sekunda|:count sekundy|:count sekúnd',
's' => ':count s',
'millisecond' => ':count milisekunda|:count milisekundy|:count milisekúnd',
'a_millisecond' => 'milisekunda|:count milisekundy|:count milisekúnd',
'ms' => ':count ms',
'microsecond' => ':count mikrosekunda|:count mikrosekundy|:count mikrosekúnd',
'a_microsecond' => 'mikrosekunda|:count mikrosekundy|:count mikrosekúnd',
'µs' => ':count µs',
'ago' => $ago,
'from_now' => $fromNow,
'before' => ':time pred',
'after' => ':time po',
'hour_after' => ':count hodinu|:count hodiny|:count hodín',
'minute_after' => ':count minútu|:count minúty|:count minút',
'second_after' => ':count sekundu|:count sekundy|:count sekúnd',
'hour_before' => ':count hodinu|:count hodiny|:count hodín',
'minute_before' => ':count minútu|:count minúty|:count minút',
'second_before' => ':count sekundu|:count sekundy|:count sekúnd',
'first_day_of_week' => 1,
'day_of_first_week_of_year' => 4,
'list' => [', ', ' a '],
'diff_now' => 'teraz',
'diff_yesterday' => 'včera',
'diff_tomorrow' => 'zajtra',
'formats' => [
'LT' => 'HH:mm',
'LTS' => 'HH:mm:ss',
'L' => 'DD.MM.YYYY',
'LL' => 'DD. MMMM YYYY',
'LLL' => 'D. M. HH:mm',
'LLLL' => 'dddd D. MMMM YYYY HH:mm',
],
'calendar' => [
'sameDay' => '[dnes o] LT',
'nextDay' => '[zajtra o] LT',
'lastDay' => '[včera o] LT',
'nextWeek' => 'dddd [o] LT',
'lastWeek' => static function (CarbonInterface $date) {
switch ($date->dayOfWeek) {
case 1:
case 2:
case 4:
case 5:
return '[minulý] dddd [o] LT'; //pondelok/utorok/štvrtok/piatok
default:
return '[minulá] dddd [o] LT';
}
},
'sameElse' => 'L',
],
'weekdays' => ['nedeľa', 'pondelok', 'utorok', 'streda', 'štvrtok', 'piatok', 'sobota'],
'weekdays_short' => ['ned', 'pon', 'uto', 'str', 'štv', 'pia', 'sob'],
'weekdays_min' => ['ne', 'po', 'ut', 'st', 'št', 'pi', 'so'],
'months' => ['január', 'február', 'marec', 'apríl', 'máj', 'jún', 'júl', 'august', 'september', 'október', 'november', 'december'],
'months_short' => ['jan', 'feb', 'mar', 'apr', 'máj', 'jún', 'júl', 'aug', 'sep', 'okt', 'nov', 'dec'],
'meridiem' => ['dopoludnia', 'popoludní'],
];