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