ZhHansTest.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <?php
  2. declare(strict_types=1);
  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. namespace Tests\Localization;
  12. /**
  13. * @group localization
  14. */
  15. class ZhHansTest extends LocalizationTestCase
  16. {
  17. public const LOCALE = 'zh_Hans'; // Chinese
  18. public const CASES = [
  19. // Carbon::parse('2018-01-04 00:00:00')->addDays(1)->calendar(Carbon::parse('2018-01-04 00:00:00'))
  20. // 'Tomorrow at 12:00 AM'
  21. '明天00:00',
  22. // Carbon::parse('2018-01-04 00:00:00')->addDays(2)->calendar(Carbon::parse('2018-01-04 00:00:00'))
  23. // 'Saturday at 12:00 AM'
  24. '下星期六00:00',
  25. // Carbon::parse('2018-01-04 00:00:00')->addDays(3)->calendar(Carbon::parse('2018-01-04 00:00:00'))
  26. // 'Sunday at 12:00 AM'
  27. '下星期日00:00',
  28. // Carbon::parse('2018-01-04 00:00:00')->addDays(4)->calendar(Carbon::parse('2018-01-04 00:00:00'))
  29. // 'Monday at 12:00 AM'
  30. '下星期一00:00',
  31. // Carbon::parse('2018-01-04 00:00:00')->addDays(5)->calendar(Carbon::parse('2018-01-04 00:00:00'))
  32. // 'Tuesday at 12:00 AM'
  33. '下星期二00:00',
  34. // Carbon::parse('2018-01-04 00:00:00')->addDays(6)->calendar(Carbon::parse('2018-01-04 00:00:00'))
  35. // 'Wednesday at 12:00 AM'
  36. '下星期三00:00',
  37. // Carbon::parse('2018-01-05 00:00:00')->addDays(6)->calendar(Carbon::parse('2018-01-05 00:00:00'))
  38. // 'Thursday at 12:00 AM'
  39. '下星期四00:00',
  40. // Carbon::parse('2018-01-06 00:00:00')->addDays(6)->calendar(Carbon::parse('2018-01-06 00:00:00'))
  41. // 'Friday at 12:00 AM'
  42. '下星期五00:00',
  43. // Carbon::parse('2018-01-07 00:00:00')->addDays(2)->calendar(Carbon::parse('2018-01-07 00:00:00'))
  44. // 'Tuesday at 12:00 AM'
  45. '下星期二00:00',
  46. // Carbon::parse('2018-01-07 00:00:00')->addDays(3)->calendar(Carbon::parse('2018-01-07 00:00:00'))
  47. // 'Wednesday at 12:00 AM'
  48. '下星期三00:00',
  49. // Carbon::parse('2018-01-07 00:00:00')->addDays(4)->calendar(Carbon::parse('2018-01-07 00:00:00'))
  50. // 'Thursday at 12:00 AM'
  51. '下星期四00:00',
  52. // Carbon::parse('2018-01-07 00:00:00')->addDays(5)->calendar(Carbon::parse('2018-01-07 00:00:00'))
  53. // 'Friday at 12:00 AM'
  54. '下星期五00:00',
  55. // Carbon::parse('2018-01-07 00:00:00')->addDays(6)->calendar(Carbon::parse('2018-01-07 00:00:00'))
  56. // 'Saturday at 12:00 AM'
  57. '下星期六00:00',
  58. // Carbon::now()->subDays(2)->calendar()
  59. // 'Last Sunday at 8:49 PM'
  60. '上星期日20:49',
  61. // Carbon::parse('2018-01-04 00:00:00')->subHours(2)->calendar(Carbon::parse('2018-01-04 00:00:00'))
  62. // 'Yesterday at 10:00 PM'
  63. '昨天22:00',
  64. // Carbon::parse('2018-01-04 12:00:00')->subHours(2)->calendar(Carbon::parse('2018-01-04 12:00:00'))
  65. // 'Today at 10:00 AM'
  66. '今天10:00',
  67. // Carbon::parse('2018-01-04 00:00:00')->addHours(2)->calendar(Carbon::parse('2018-01-04 00:00:00'))
  68. // 'Today at 2:00 AM'
  69. '今天02:00',
  70. // Carbon::parse('2018-01-04 23:00:00')->addHours(2)->calendar(Carbon::parse('2018-01-04 23:00:00'))
  71. // 'Tomorrow at 1:00 AM'
  72. '明天01:00',
  73. // Carbon::parse('2018-01-07 00:00:00')->addDays(2)->calendar(Carbon::parse('2018-01-07 00:00:00'))
  74. // 'Tuesday at 12:00 AM'
  75. '下星期二00:00',
  76. // Carbon::parse('2018-01-08 00:00:00')->subDay()->calendar(Carbon::parse('2018-01-08 00:00:00'))
  77. // 'Yesterday at 12:00 AM'
  78. '昨天00:00',
  79. // Carbon::parse('2018-01-04 00:00:00')->subDays(1)->calendar(Carbon::parse('2018-01-04 00:00:00'))
  80. // 'Yesterday at 12:00 AM'
  81. '昨天00:00',
  82. // Carbon::parse('2018-01-04 00:00:00')->subDays(2)->calendar(Carbon::parse('2018-01-04 00:00:00'))
  83. // 'Last Tuesday at 12:00 AM'
  84. '上星期二00:00',
  85. // Carbon::parse('2018-01-04 00:00:00')->subDays(3)->calendar(Carbon::parse('2018-01-04 00:00:00'))
  86. // 'Last Monday at 12:00 AM'
  87. '上星期一00:00',
  88. // Carbon::parse('2018-01-04 00:00:00')->subDays(4)->calendar(Carbon::parse('2018-01-04 00:00:00'))
  89. // 'Last Sunday at 12:00 AM'
  90. '上星期日00:00',
  91. // Carbon::parse('2018-01-04 00:00:00')->subDays(5)->calendar(Carbon::parse('2018-01-04 00:00:00'))
  92. // 'Last Saturday at 12:00 AM'
  93. '上星期六00:00',
  94. // Carbon::parse('2018-01-04 00:00:00')->subDays(6)->calendar(Carbon::parse('2018-01-04 00:00:00'))
  95. // 'Last Friday at 12:00 AM'
  96. '上星期五00:00',
  97. // Carbon::parse('2018-01-03 00:00:00')->subDays(6)->calendar(Carbon::parse('2018-01-03 00:00:00'))
  98. // 'Last Thursday at 12:00 AM'
  99. '上星期四00:00',
  100. // Carbon::parse('2018-01-02 00:00:00')->subDays(6)->calendar(Carbon::parse('2018-01-02 00:00:00'))
  101. // 'Last Wednesday at 12:00 AM'
  102. '上星期三00:00',
  103. // Carbon::parse('2018-01-07 00:00:00')->subDays(2)->calendar(Carbon::parse('2018-01-07 00:00:00'))
  104. // 'Last Friday at 12:00 AM'
  105. '上星期五00:00',
  106. // Carbon::parse('2018-01-01 00:00:00')->isoFormat('Qo Mo Do Wo wo')
  107. // '1st 1st 1st 1st 1st'
  108. '1月 1月 1日 1周 1周',
  109. // Carbon::parse('2018-01-02 00:00:00')->isoFormat('Do wo')
  110. // '2nd 1st'
  111. '2日 1周',
  112. // Carbon::parse('2018-01-03 00:00:00')->isoFormat('Do wo')
  113. // '3rd 1st'
  114. '3日 1周',
  115. // Carbon::parse('2018-01-04 00:00:00')->isoFormat('Do wo')
  116. // '4th 1st'
  117. '4日 1周',
  118. // Carbon::parse('2018-01-05 00:00:00')->isoFormat('Do wo')
  119. // '5th 1st'
  120. '5日 1周',
  121. // Carbon::parse('2018-01-06 00:00:00')->isoFormat('Do wo')
  122. // '6th 1st'
  123. '6日 1周',
  124. // Carbon::parse('2018-01-07 00:00:00')->isoFormat('Do wo')
  125. // '7th 2nd'
  126. '7日 1周',
  127. // Carbon::parse('2018-01-11 00:00:00')->isoFormat('Do wo')
  128. // '11th 2nd'
  129. '11日 2周',
  130. // Carbon::parse('2018-02-09 00:00:00')->isoFormat('DDDo')
  131. // '40th'
  132. '40日',
  133. // Carbon::parse('2018-02-10 00:00:00')->isoFormat('DDDo')
  134. // '41st'
  135. '41日',
  136. // Carbon::parse('2018-04-10 00:00:00')->isoFormat('DDDo')
  137. // '100th'
  138. '100日',
  139. // Carbon::parse('2018-02-10 00:00:00', 'Europe/Paris')->isoFormat('h:mm a z')
  140. // '12:00 am CET'
  141. '12:00 凌晨 CET',
  142. // Carbon::parse('2018-02-10 00:00:00')->isoFormat('h:mm A, h:mm a')
  143. // '12:00 AM, 12:00 am'
  144. '12:00 凌晨, 12:00 凌晨',
  145. // Carbon::parse('2018-02-10 01:30:00')->isoFormat('h:mm A, h:mm a')
  146. // '1:30 AM, 1:30 am'
  147. '1:30 凌晨, 1:30 凌晨',
  148. // Carbon::parse('2018-02-10 02:00:00')->isoFormat('h:mm A, h:mm a')
  149. // '2:00 AM, 2:00 am'
  150. '2:00 凌晨, 2:00 凌晨',
  151. // Carbon::parse('2018-02-10 06:00:00')->isoFormat('h:mm A, h:mm a')
  152. // '6:00 AM, 6:00 am'
  153. '6:00 早上, 6:00 早上',
  154. // Carbon::parse('2018-02-10 10:00:00')->isoFormat('h:mm A, h:mm a')
  155. // '10:00 AM, 10:00 am'
  156. '10:00 上午, 10:00 上午',
  157. // Carbon::parse('2018-02-10 12:00:00')->isoFormat('h:mm A, h:mm a')
  158. // '12:00 PM, 12:00 pm'
  159. '12:00 中午, 12:00 中午',
  160. // Carbon::parse('2018-02-10 17:00:00')->isoFormat('h:mm A, h:mm a')
  161. // '5:00 PM, 5:00 pm'
  162. '5:00 下午, 5:00 下午',
  163. // Carbon::parse('2018-02-10 21:30:00')->isoFormat('h:mm A, h:mm a')
  164. // '9:30 PM, 9:30 pm'
  165. '9:30 晚上, 9:30 晚上',
  166. // Carbon::parse('2018-02-10 23:00:00')->isoFormat('h:mm A, h:mm a')
  167. // '11:00 PM, 11:00 pm'
  168. '11:00 晚上, 11:00 晚上',
  169. // Carbon::parse('2018-01-01 00:00:00')->ordinal('hour')
  170. // '0th'
  171. '0',
  172. // Carbon::now()->subSeconds(1)->diffForHumans()
  173. // '1 second ago'
  174. '1秒前',
  175. // Carbon::now()->subSeconds(1)->diffForHumans(null, false, true)
  176. // '1s ago'
  177. '1秒前',
  178. // Carbon::now()->subSeconds(2)->diffForHumans()
  179. // '2 seconds ago'
  180. '2秒前',
  181. // Carbon::now()->subSeconds(2)->diffForHumans(null, false, true)
  182. // '2s ago'
  183. '2秒前',
  184. // Carbon::now()->subMinutes(1)->diffForHumans()
  185. // '1 minute ago'
  186. '1分钟前',
  187. // Carbon::now()->subMinutes(1)->diffForHumans(null, false, true)
  188. // '1m ago'
  189. '1分钟前',
  190. // Carbon::now()->subMinutes(2)->diffForHumans()
  191. // '2 minutes ago'
  192. '2分钟前',
  193. // Carbon::now()->subMinutes(2)->diffForHumans(null, false, true)
  194. // '2m ago'
  195. '2分钟前',
  196. // Carbon::now()->subHours(1)->diffForHumans()
  197. // '1 hour ago'
  198. '1小时前',
  199. // Carbon::now()->subHours(1)->diffForHumans(null, false, true)
  200. // '1h ago'
  201. '1小时前',
  202. // Carbon::now()->subHours(2)->diffForHumans()
  203. // '2 hours ago'
  204. '2小时前',
  205. // Carbon::now()->subHours(2)->diffForHumans(null, false, true)
  206. // '2h ago'
  207. '2小时前',
  208. // Carbon::now()->subDays(1)->diffForHumans()
  209. // '1 day ago'
  210. '1天前',
  211. // Carbon::now()->subDays(1)->diffForHumans(null, false, true)
  212. // '1d ago'
  213. '1天前',
  214. // Carbon::now()->subDays(2)->diffForHumans()
  215. // '2 days ago'
  216. '2天前',
  217. // Carbon::now()->subDays(2)->diffForHumans(null, false, true)
  218. // '2d ago'
  219. '2天前',
  220. // Carbon::now()->subWeeks(1)->diffForHumans()
  221. // '1 week ago'
  222. '1周前',
  223. // Carbon::now()->subWeeks(1)->diffForHumans(null, false, true)
  224. // '1w ago'
  225. '1周前',
  226. // Carbon::now()->subWeeks(2)->diffForHumans()
  227. // '2 weeks ago'
  228. '2周前',
  229. // Carbon::now()->subWeeks(2)->diffForHumans(null, false, true)
  230. // '2w ago'
  231. '2周前',
  232. // Carbon::now()->subMonths(1)->diffForHumans()
  233. // '1 month ago'
  234. '1个月前',
  235. // Carbon::now()->subMonths(1)->diffForHumans(null, false, true)
  236. // '1mo ago'
  237. '1个月前',
  238. // Carbon::now()->subMonths(2)->diffForHumans()
  239. // '2 months ago'
  240. '2个月前',
  241. // Carbon::now()->subMonths(2)->diffForHumans(null, false, true)
  242. // '2mos ago'
  243. '2个月前',
  244. // Carbon::now()->subYears(1)->diffForHumans()
  245. // '1 year ago'
  246. '1年前',
  247. // Carbon::now()->subYears(1)->diffForHumans(null, false, true)
  248. // '1yr ago'
  249. '1年前',
  250. // Carbon::now()->subYears(2)->diffForHumans()
  251. // '2 years ago'
  252. '2年前',
  253. // Carbon::now()->subYears(2)->diffForHumans(null, false, true)
  254. // '2yrs ago'
  255. '2年前',
  256. // Carbon::now()->addSecond()->diffForHumans()
  257. // '1 second from now'
  258. '1秒后',
  259. // Carbon::now()->addSecond()->diffForHumans(null, false, true)
  260. // '1s from now'
  261. '1秒后',
  262. // Carbon::now()->addSecond()->diffForHumans(Carbon::now())
  263. // '1 second after'
  264. '1秒后',
  265. // Carbon::now()->addSecond()->diffForHumans(Carbon::now(), false, true)
  266. // '1s after'
  267. '1秒后',
  268. // Carbon::now()->diffForHumans(Carbon::now()->addSecond())
  269. // '1 second before'
  270. '1秒前',
  271. // Carbon::now()->diffForHumans(Carbon::now()->addSecond(), false, true)
  272. // '1s before'
  273. '1秒前',
  274. // Carbon::now()->addSecond()->diffForHumans(Carbon::now(), true)
  275. // '1 second'
  276. '1秒',
  277. // Carbon::now()->addSecond()->diffForHumans(Carbon::now(), true, true)
  278. // '1s'
  279. '1秒',
  280. // Carbon::now()->diffForHumans(Carbon::now()->addSecond()->addSecond(), true)
  281. // '2 seconds'
  282. '2秒',
  283. // Carbon::now()->diffForHumans(Carbon::now()->addSecond()->addSecond(), true, true)
  284. // '2s'
  285. '2秒',
  286. // Carbon::now()->addSecond()->diffForHumans(null, false, true, 1)
  287. // '1s from now'
  288. '1秒后',
  289. // Carbon::now()->addMinute()->addSecond()->diffForHumans(null, true, false, 2)
  290. // '1 minute 1 second'
  291. '1分钟1秒',
  292. // Carbon::now()->addYears(2)->addMonths(3)->addDay()->addSecond()->diffForHumans(null, true, true, 4)
  293. // '2yrs 3mos 1d 1s'
  294. '2年3个月1天1秒',
  295. // Carbon::now()->addYears(3)->diffForHumans(null, null, false, 4)
  296. // '3 years from now'
  297. '3年后',
  298. // Carbon::now()->subMonths(5)->diffForHumans(null, null, true, 4)
  299. // '5mos ago'
  300. '5个月前',
  301. // Carbon::now()->subYears(2)->subMonths(3)->subDay()->subSecond()->diffForHumans(null, null, true, 4)
  302. // '2yrs 3mos 1d 1s ago'
  303. '2年3个月1天1秒前',
  304. // Carbon::now()->addWeek()->addHours(10)->diffForHumans(null, true, false, 2)
  305. // '1 week 10 hours'
  306. '1周10小时',
  307. // Carbon::now()->addWeek()->addDays(6)->diffForHumans(null, true, false, 2)
  308. // '1 week 6 days'
  309. '1周6天',
  310. // Carbon::now()->addWeek()->addDays(6)->diffForHumans(null, true, false, 2)
  311. // '1 week 6 days'
  312. '1周6天',
  313. // Carbon::now()->addWeek()->addDays(6)->diffForHumans(["join" => true, "parts" => 2])
  314. // '1 week and 6 days from now'
  315. '1周6天后',
  316. // Carbon::now()->addWeeks(2)->addHour()->diffForHumans(null, true, false, 2)
  317. // '2 weeks 1 hour'
  318. '2周1小时',
  319. // Carbon::now()->addHour()->diffForHumans(["aUnit" => true])
  320. // 'an hour from now'
  321. '1小时后',
  322. // CarbonInterval::days(2)->forHumans()
  323. // '2 days'
  324. '2天',
  325. // CarbonInterval::create('P1DT3H')->forHumans(true)
  326. // '1d 3h'
  327. '1天3小时',
  328. ];
  329. }