Skip to content

Commit

Permalink
Merge pull request #2872 from s4muel/fix-slovak-translations
Browse files Browse the repository at this point in the history
Fix Slovakian translations
  • Loading branch information
kylekatarnls authored Oct 20, 2023
2 parents ab853f0 + 177cbcd commit b02302e
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 110 deletions.
108 changes: 90 additions & 18 deletions src/Carbon/Lang/sk.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,87 @@
* - 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' => 'rok|:count roky|:count rokov',
'year' => ':count rok|:count roky|:count rokov',
'a_year' => 'rok|:count roky|:count rokov',
'y' => ':count r',
'month' => 'mesiac|:count mesiace|:count mesiacov',
'month' => ':count mesiac|:count mesiace|:count mesiacov',
'a_month' => 'mesiac|:count mesiace|:count mesiacov',
'm' => ':count m',
'week' => 'týždeň|:count týždne|:count týždňov',
'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' => 'deň|:count dni|:count dní',
'day' => ':count deň|:count dni|:count dní',
'a_day' => 'deň|:count dni|:count dní',
'd' => ':count d',
'hour' => 'hodinu|:count hodiny|:count hodín',
'hour' => ':count hodina|:count hodiny|:count hodín',
'a_hour' => 'hodina|:count hodiny|:count hodín',
'h' => ':count h',
'minute' => 'minútu|:count minúty|:count minút',
'minute' => ':count minúta|:count minúty|:count minút',
'a_minute' => 'minúta|:count minúty|:count minút',
'min' => ':count min',
'second' => 'sekundu|:count sekundy|:count sekúnd',
'a_second' => 'pár sekúnd|:count sekundy|:count sekúnd',
'second' => ':count sekunda|:count sekundy|:count sekúnd',
'a_second' => 'sekunda|:count sekundy|:count sekúnd',
's' => ':count s',
'ago' => 'pred :time',
'from_now' => 'o :time',
'after' => ':time po',
'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',
'year_ago' => 'rokom|:count rokmi|:count rokmi',
'month_ago' => 'mesiacom|:count mesiacmi|:count mesiacmi',
'week_ago' => 'týždňom|:count týždňami|:count týždňami',
'day_ago' => 'dňom|:count dňami|:count dňami',
'hour_ago' => 'hodinou|:count hodinami|:count hodinami',
'minute_ago' => 'minútou|:count minútami|:count minútami',
'second_ago' => 'sekundou|:count sekundami|:count sekundami',
'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 '],
Expand All @@ -74,6 +128,24 @@
'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', 'pod', 'uto', 'str', 'štv', 'pia', 'sob'],
'weekdays_min' => ['ne', 'po', 'ut', 'st', 'št', 'pi', 'so'],
Expand Down
92 changes: 46 additions & 46 deletions tests/Localization/SkSkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,63 +22,63 @@ class SkSkTest extends LocalizationTestCase

public const CASES = [
// Carbon::parse('2018-01-04 00:00:00')->addDays(1)->calendar(Carbon::parse('2018-01-04 00:00:00'))
'Tomorrow at 00:00',
'zajtra o 00:00',
// Carbon::parse('2018-01-04 00:00:00')->addDays(2)->calendar(Carbon::parse('2018-01-04 00:00:00'))
'sobota at 00:00',
'sobota o 00:00',
// Carbon::parse('2018-01-04 00:00:00')->addDays(3)->calendar(Carbon::parse('2018-01-04 00:00:00'))
'nedeľa at 00:00',
'nedeľa o 00:00',
// Carbon::parse('2018-01-04 00:00:00')->addDays(4)->calendar(Carbon::parse('2018-01-04 00:00:00'))
'pondelok at 00:00',
'pondelok o 00:00',
// Carbon::parse('2018-01-04 00:00:00')->addDays(5)->calendar(Carbon::parse('2018-01-04 00:00:00'))
'utorok at 00:00',
'utorok o 00:00',
// Carbon::parse('2018-01-04 00:00:00')->addDays(6)->calendar(Carbon::parse('2018-01-04 00:00:00'))
'streda at 00:00',
'streda o 00:00',
// Carbon::parse('2018-01-05 00:00:00')->addDays(6)->calendar(Carbon::parse('2018-01-05 00:00:00'))
'štvrtok at 00:00',
'štvrtok o 00:00',
// Carbon::parse('2018-01-06 00:00:00')->addDays(6)->calendar(Carbon::parse('2018-01-06 00:00:00'))
'piatok at 00:00',
'piatok o 00:00',
// Carbon::parse('2018-01-07 00:00:00')->addDays(2)->calendar(Carbon::parse('2018-01-07 00:00:00'))
'utorok at 00:00',
'utorok o 00:00',
// Carbon::parse('2018-01-07 00:00:00')->addDays(3)->calendar(Carbon::parse('2018-01-07 00:00:00'))
'streda at 00:00',
'streda o 00:00',
// Carbon::parse('2018-01-07 00:00:00')->addDays(4)->calendar(Carbon::parse('2018-01-07 00:00:00'))
'štvrtok at 00:00',
'štvrtok o 00:00',
// Carbon::parse('2018-01-07 00:00:00')->addDays(5)->calendar(Carbon::parse('2018-01-07 00:00:00'))
'piatok at 00:00',
'piatok o 00:00',
// Carbon::parse('2018-01-07 00:00:00')->addDays(6)->calendar(Carbon::parse('2018-01-07 00:00:00'))
'sobota at 00:00',
'sobota o 00:00',
// Carbon::now()->subDays(2)->calendar()
'Last nedeľa at 20:49',
'minulá nedeľa o 20:49',
// Carbon::parse('2018-01-04 00:00:00')->subHours(2)->calendar(Carbon::parse('2018-01-04 00:00:00'))
'Yesterday at 22:00',
'včera o 22:00',
// Carbon::parse('2018-01-04 12:00:00')->subHours(2)->calendar(Carbon::parse('2018-01-04 12:00:00'))
'Today at 10:00',
'dnes o 10:00',
// Carbon::parse('2018-01-04 00:00:00')->addHours(2)->calendar(Carbon::parse('2018-01-04 00:00:00'))
'Today at 02:00',
'dnes o 02:00',
// Carbon::parse('2018-01-04 23:00:00')->addHours(2)->calendar(Carbon::parse('2018-01-04 23:00:00'))
'Tomorrow at 01:00',
'zajtra o 01:00',
// Carbon::parse('2018-01-07 00:00:00')->addDays(2)->calendar(Carbon::parse('2018-01-07 00:00:00'))
'utorok at 00:00',
'utorok o 00:00',
// Carbon::parse('2018-01-08 00:00:00')->subDay()->calendar(Carbon::parse('2018-01-08 00:00:00'))
'Yesterday at 00:00',
'včera o 00:00',
// Carbon::parse('2018-01-04 00:00:00')->subDays(1)->calendar(Carbon::parse('2018-01-04 00:00:00'))
'Yesterday at 00:00',
'včera o 00:00',
// Carbon::parse('2018-01-04 00:00:00')->subDays(2)->calendar(Carbon::parse('2018-01-04 00:00:00'))
'Last utorok at 00:00',
'minulý utorok o 00:00',
// Carbon::parse('2018-01-04 00:00:00')->subDays(3)->calendar(Carbon::parse('2018-01-04 00:00:00'))
'Last pondelok at 00:00',
'minulý pondelok o 00:00',
// Carbon::parse('2018-01-04 00:00:00')->subDays(4)->calendar(Carbon::parse('2018-01-04 00:00:00'))
'Last nedeľa at 00:00',
'minulá nedeľa o 00:00',
// Carbon::parse('2018-01-04 00:00:00')->subDays(5)->calendar(Carbon::parse('2018-01-04 00:00:00'))
'Last sobota at 00:00',
'minulá sobota o 00:00',
// Carbon::parse('2018-01-04 00:00:00')->subDays(6)->calendar(Carbon::parse('2018-01-04 00:00:00'))
'Last piatok at 00:00',
'minulý piatok o 00:00',
// Carbon::parse('2018-01-03 00:00:00')->subDays(6)->calendar(Carbon::parse('2018-01-03 00:00:00'))
'Last štvrtok at 00:00',
'minulý štvrtok o 00:00',
// Carbon::parse('2018-01-02 00:00:00')->subDays(6)->calendar(Carbon::parse('2018-01-02 00:00:00'))
'Last streda at 00:00',
'minulá streda o 00:00',
// Carbon::parse('2018-01-07 00:00:00')->subDays(2)->calendar(Carbon::parse('2018-01-07 00:00:00'))
'Last piatok at 00:00',
'minulý piatok o 00:00',
// Carbon::parse('2018-01-01 00:00:00')->isoFormat('Qo Mo Do Wo wo')
'1 1 1 1 1',
// Carbon::parse('2018-01-02 00:00:00')->isoFormat('Do wo')
Expand Down Expand Up @@ -124,75 +124,75 @@ class SkSkTest extends LocalizationTestCase
// Carbon::parse('2018-01-01 00:00:00')->ordinal('hour')
'0',
// Carbon::now()->subSeconds(1)->diffForHumans()
'pred sekundou',
'pred 1 sekundou',
// Carbon::now()->subSeconds(1)->diffForHumans(null, false, true)
'pred 1 s',
// Carbon::now()->subSeconds(2)->diffForHumans()
'pred 2 sekundami',
// Carbon::now()->subSeconds(2)->diffForHumans(null, false, true)
'pred 2 s',
// Carbon::now()->subMinutes(1)->diffForHumans()
'pred minútou',
'pred 1 minútou',
// Carbon::now()->subMinutes(1)->diffForHumans(null, false, true)
'pred 1 min',
// Carbon::now()->subMinutes(2)->diffForHumans()
'pred 2 minútami',
// Carbon::now()->subMinutes(2)->diffForHumans(null, false, true)
'pred 2 min',
// Carbon::now()->subHours(1)->diffForHumans()
'pred hodinou',
'pred 1 hodinou',
// Carbon::now()->subHours(1)->diffForHumans(null, false, true)
'pred 1 h',
// Carbon::now()->subHours(2)->diffForHumans()
'pred 2 hodinami',
// Carbon::now()->subHours(2)->diffForHumans(null, false, true)
'pred 2 h',
// Carbon::now()->subDays(1)->diffForHumans()
'pred dňom',
'pred 1 dňom',
// Carbon::now()->subDays(1)->diffForHumans(null, false, true)
'pred 1 d',
// Carbon::now()->subDays(2)->diffForHumans()
'pred 2 dňami',
// Carbon::now()->subDays(2)->diffForHumans(null, false, true)
'pred 2 d',
// Carbon::now()->subWeeks(1)->diffForHumans()
'pred týždňom',
'pred 1 týždňom',
// Carbon::now()->subWeeks(1)->diffForHumans(null, false, true)
'pred 1 t',
// Carbon::now()->subWeeks(2)->diffForHumans()
'pred 2 týždňami',
// Carbon::now()->subWeeks(2)->diffForHumans(null, false, true)
'pred 2 t',
// Carbon::now()->subMonths(1)->diffForHumans()
'pred mesiacom',
'pred 1 mesiacom',
// Carbon::now()->subMonths(1)->diffForHumans(null, false, true)
'pred 1 m',
// Carbon::now()->subMonths(2)->diffForHumans()
'pred 2 mesiacmi',
// Carbon::now()->subMonths(2)->diffForHumans(null, false, true)
'pred 2 m',
// Carbon::now()->subYears(1)->diffForHumans()
'pred rokom',
'pred 1 rokom',
// Carbon::now()->subYears(1)->diffForHumans(null, false, true)
'pred 1 r',
// Carbon::now()->subYears(2)->diffForHumans()
'pred 2 rokmi',
// Carbon::now()->subYears(2)->diffForHumans(null, false, true)
'pred 2 r',
// Carbon::now()->addSecond()->diffForHumans()
'o sekundu',
'o 1 sekundu',
// Carbon::now()->addSecond()->diffForHumans(null, false, true)
'o 1 s',
// Carbon::now()->addSecond()->diffForHumans(Carbon::now())
'sekundu po',
'1 sekundu po',
// Carbon::now()->addSecond()->diffForHumans(Carbon::now(), false, true)
'1 s po',
// Carbon::now()->diffForHumans(Carbon::now()->addSecond())
'sekundu pred',
'1 sekundu pred',
// Carbon::now()->diffForHumans(Carbon::now()->addSecond(), false, true)
'1 s pred',
// Carbon::now()->addSecond()->diffForHumans(Carbon::now(), true)
'sekundu',
'1 sekunda',
// Carbon::now()->addSecond()->diffForHumans(Carbon::now(), true, true)
'1 s',
// Carbon::now()->diffForHumans(Carbon::now()->addSecond()->addSecond(), true)
Expand All @@ -202,7 +202,7 @@ class SkSkTest extends LocalizationTestCase
// Carbon::now()->addSecond()->diffForHumans(null, false, true, 1)
'o 1 s',
// Carbon::now()->addMinute()->addSecond()->diffForHumans(null, true, false, 2)
'minútu sekundu',
'1 minúta 1 sekunda',
// Carbon::now()->addYears(2)->addMonths(3)->addDay()->addSecond()->diffForHumans(null, true, true, 4)
'2 r 3 m 1 d 1 s',
// Carbon::now()->addYears(3)->diffForHumans(null, null, false, 4)
Expand All @@ -212,15 +212,15 @@ class SkSkTest extends LocalizationTestCase
// Carbon::now()->subYears(2)->subMonths(3)->subDay()->subSecond()->diffForHumans(null, null, true, 4)
'pred 2 r 3 m 1 d 1 s',
// Carbon::now()->addWeek()->addHours(10)->diffForHumans(null, true, false, 2)
'týždeň 10 hodín',
'1 týždeň 10 hodín',
// Carbon::now()->addWeek()->addDays(6)->diffForHumans(null, true, false, 2)
'týždeň 6 dní',
'1 týždeň 6 dní',
// Carbon::now()->addWeek()->addDays(6)->diffForHumans(null, true, false, 2)
'týždeň 6 dní',
'1 týždeň 6 dní',
// Carbon::now()->addWeek()->addDays(6)->diffForHumans(["join" => true, "parts" => 2])
'o týždeň a 6 dní',
'o 1 týždeň a 6 dní',
// Carbon::now()->addWeeks(2)->addHour()->diffForHumans(null, true, false, 2)
'2 týždne hodinu',
'2 týždne 1 hodina',
// Carbon::now()->addHour()->diffForHumans(["aUnit" => true])
'o hodinu',
// CarbonInterval::days(2)->forHumans()
Expand Down
Loading

0 comments on commit b02302e

Please sign in to comment.