blob: ab2d8678c23dd7e121a7d6878e58b7a4f921ee10 [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3/**
4 * This file is part of the Carbon package.
5 *
6 * (c) Brian Nesbitt <brian@nesbot.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11$processHoursFunction = function (\Carbon\CarbonInterface $date, string $format) {
12 return $format.'о'.($date->hour === 11 ? 'б' : '').'] LT';
13};
14
15/*
16 * Authors:
17 * - Kunal Marwaha
18 * - Josh Soref
19 * - François B
20 * - Tim Fish
21 * - Serhan Apaydın
22 * - Max Mykhailenko
23 * - JD Isaacks
24 * - Max Kovpak
25 * - AucT
26 * - Philippe Vaucher
27 * - Ilya Shaplyko
28 * - Vadym Ievsieiev
29 * - Denys Kurets
30 * - Igor Kasyanchuk
31 * - Tsutomu Kuroda
32 * - tjku
33 * - Max Melentiev
34 * - Oleh
35 * - epaminond
36 * - Juanito Fatas
37 * - Vitalii Khustochka
38 * - Akira Matsuda
39 * - Christopher Dell
40 * - Enrique Vidal
41 * - Simone Carletti
42 * - Aaron Patterson
43 * - Andriy Tyurnikov
44 * - Nicolás Hock Isaza
45 * - Iwakura Taro
46 * - Andrii Ponomarov
47 * - alecrabbit
48 * - vystepanenko
49 * - AlexWalkerson
50 * - Andre Havryliuk (Andrend)
51 * - Max Datsenko (datsenko-md)
52 */
53return [
54 'year' => ':count рік|:count роки|:count років',
55 'y' => ':countр',
56 'a_year' => '{1}рік|:count рік|:count роки|:count років',
57 'month' => ':count місяць|:count місяці|:count місяців',
58 'm' => ':countм',
59 'a_month' => '{1}місяць|:count місяць|:count місяці|:count місяців',
60 'week' => ':count тиждень|:count тижні|:count тижнів',
61 'w' => ':countт',
62 'a_week' => '{1}тиждень|:count тиждень|:count тижні|:count тижнів',
63 'day' => ':count день|:count дні|:count днів',
64 'd' => ':countд',
65 'a_day' => '{1}день|:count день|:count дні|:count днів',
66 'hour' => ':count година|:count години|:count годин',
67 'h' => ':countг',
68 'a_hour' => '{1}година|:count година|:count години|:count годин',
69 'minute' => ':count хвилина|:count хвилини|:count хвилин',
70 'min' => ':countхв',
71 'a_minute' => '{1}хвилина|:count хвилина|:count хвилини|:count хвилин',
72 'second' => ':count секунда|:count секунди|:count секунд',
73 's' => ':countсек',
74 'a_second' => '{1}декілька секунд|:count секунда|:count секунди|:count секунд',
75
76 'hour_ago' => ':count годину|:count години|:count годин',
77 'a_hour_ago' => '{1}годину|:count годину|:count години|:count годин',
78 'minute_ago' => ':count хвилину|:count хвилини|:count хвилин',
79 'a_minute_ago' => '{1}хвилину|:count хвилину|:count хвилини|:count хвилин',
80 'second_ago' => ':count секунду|:count секунди|:count секунд',
81 'a_second_ago' => '{1}декілька секунд|:count секунду|:count секунди|:count секунд',
82
83 'hour_from_now' => ':count годину|:count години|:count годин',
84 'a_hour_from_now' => '{1}годину|:count годину|:count години|:count годин',
85 'minute_from_now' => ':count хвилину|:count хвилини|:count хвилин',
86 'a_minute_from_now' => '{1}хвилину|:count хвилину|:count хвилини|:count хвилин',
87 'second_from_now' => ':count секунду|:count секунди|:count секунд',
88 'a_second_from_now' => '{1}декілька секунд|:count секунду|:count секунди|:count секунд',
89
90 'hour_after' => ':count годину|:count години|:count годин',
91 'a_hour_after' => '{1}годину|:count годину|:count години|:count годин',
92 'minute_after' => ':count хвилину|:count хвилини|:count хвилин',
93 'a_minute_after' => '{1}хвилину|:count хвилину|:count хвилини|:count хвилин',
94 'second_after' => ':count секунду|:count секунди|:count секунд',
95 'a_second_after' => '{1}декілька секунд|:count секунду|:count секунди|:count секунд',
96
97 'hour_before' => ':count годину|:count години|:count годин',
98 'a_hour_before' => '{1}годину|:count годину|:count години|:count годин',
99 'minute_before' => ':count хвилину|:count хвилини|:count хвилин',
100 'a_minute_before' => '{1}хвилину|:count хвилину|:count хвилини|:count хвилин',
101 'second_before' => ':count секунду|:count секунди|:count секунд',
102 'a_second_before' => '{1}декілька секунд|:count секунду|:count секунди|:count секунд',
103
104 'ago' => ':time тому',
105 'from_now' => 'за :time',
106 'after' => ':time після',
107 'before' => ':time до',
108 'diff_now' => 'щойно',
109 'diff_today' => 'Сьогодні',
110 'diff_today_regexp' => 'Сьогодні(?:\\s+о)?',
111 'diff_yesterday' => 'вчора',
112 'diff_yesterday_regexp' => 'Вчора(?:\\s+о)?',
113 'diff_tomorrow' => 'завтра',
114 'diff_tomorrow_regexp' => 'Завтра(?:\\s+о)?',
115 'diff_before_yesterday' => 'позавчора',
116 'diff_after_tomorrow' => 'післязавтра',
117 'period_recurrences' => 'один раз|:count рази|:count разів',
118 'period_interval' => 'кожні :interval',
119 'period_start_date' => 'з :date',
120 'period_end_date' => 'до :date',
121 'formats' => [
122 'LT' => 'HH:mm',
123 'LTS' => 'HH:mm:ss',
124 'L' => 'DD.MM.YYYY',
125 'LL' => 'D MMMM YYYY',
126 'LLL' => 'D MMMM YYYY, HH:mm',
127 'LLLL' => 'dddd, D MMMM YYYY, HH:mm',
128 ],
129 'calendar' => [
130 'sameDay' => function (\Carbon\CarbonInterface $date) use ($processHoursFunction) {
131 return $processHoursFunction($date, '[Сьогодні ');
132 },
133 'nextDay' => function (\Carbon\CarbonInterface $date) use ($processHoursFunction) {
134 return $processHoursFunction($date, '[Завтра ');
135 },
136 'nextWeek' => function (\Carbon\CarbonInterface $date) use ($processHoursFunction) {
137 return $processHoursFunction($date, '[У] dddd [');
138 },
139 'lastDay' => function (\Carbon\CarbonInterface $date) use ($processHoursFunction) {
140 return $processHoursFunction($date, '[Вчора ');
141 },
142 'lastWeek' => function (\Carbon\CarbonInterface $date) use ($processHoursFunction) {
143 switch ($date->dayOfWeek) {
144 case 0:
145 case 3:
146 case 5:
147 case 6:
148 return $processHoursFunction($date, '[Минулої] dddd [');
149 default:
150 return $processHoursFunction($date, '[Минулого] dddd [');
151 }
152 },
153 'sameElse' => 'L',
154 ],
155 'ordinal' => function ($number, $period) {
156 switch ($period) {
157 case 'M':
158 case 'd':
159 case 'DDD':
160 case 'w':
161 case 'W':
162 return $number.'-й';
163 case 'D':
164 return $number.'-го';
165 default:
166 return $number;
167 }
168 },
169 'meridiem' => function ($hour) {
170 if ($hour < 4) {
171 return 'ночі';
172 }
173 if ($hour < 12) {
174 return 'ранку';
175 }
176 if ($hour < 17) {
177 return 'дня';
178 }
179
180 return 'вечора';
181 },
182 'months' => ['січня', 'лютого', 'березня', 'квітня', 'травня', 'червня', 'липня', 'серпня', 'вересня', 'жовтня', 'листопада', 'грудня'],
183 'months_standalone' => ['січень', 'лютий', 'березень', 'квітень', 'травень', 'червень', 'липень', 'серпень', 'вересень', 'жовтень', 'листопад', 'грудень'],
184 'months_short' => ['січ', 'лют', 'бер', 'кві', 'тра', 'чер', 'лип', 'сер', 'вер', 'жов', 'лис', 'гру'],
185 'months_regexp' => '/(D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|L{2,4}|l{2,4})/',
186 'weekdays' => function (\Carbon\CarbonInterface $date, $format, $index) {
187 static $words = [
188 'nominative' => ['неділя', 'понеділок', 'вівторок', 'середа', 'четвер', 'п’ятниця', 'субота'],
189 'accusative' => ['неділю', 'понеділок', 'вівторок', 'середу', 'четвер', 'п’ятницю', 'суботу'],
190 'genitive' => ['неділі', 'понеділка', 'вівторка', 'середи', 'четверга', 'п’ятниці', 'суботи'],
191 ];
192
193 $nounCase = preg_match('/(\[(В|в|У|у)\])\s+dddd/', $format)
194 ? 'accusative'
195 : (
196 preg_match('/\[?(?:минулої|наступної)?\s*\]\s+dddd/', $format)
197 ? 'genitive'
198 : 'nominative'
199 );
200
201 return $words[$nounCase][$index] ?? null;
202 },
203 'weekdays_short' => ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
204 'weekdays_min' => ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
205 'first_day_of_week' => 1,
206 'day_of_first_week_of_year' => 1,
207 'list' => [', ', ' i '],
208];