Skip to content

Commit

Permalink
Merge branch 'spatie:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-wolf-gb authored Mar 21, 2024
2 parents f7c8094 + ee306ae commit 404e998
Show file tree
Hide file tree
Showing 30 changed files with 500 additions and 123 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

All notable changes to `holidays` will be documented in this file.

## 1.8.0 - 2024-03-08

### What's Changed

* Adding holidays for Bahrain by @bo3bdo in https://github.com/spatie/holidays/pull/206
* Add default locale by @Nielsvanpach in https://github.com/spatie/holidays/pull/208
* Fix: Canada Victoria Day correction in test and calculation by @mercury64 in https://github.com/spatie/holidays/pull/211

### New Contributors

* @bo3bdo made their first contribution in https://github.com/spatie/holidays/pull/206
* @mercury64 made their first contribution in https://github.com/spatie/holidays/pull/211

**Full Changelog**: https://github.com/spatie/holidays/compare/1.7.0...1.8.0

## 1.7.0 - 2024-02-08

### What's Changed
Expand Down
16 changes: 16 additions & 0 deletions lang/bahrain/ar/holidays.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"New Year\\'s Day": "رأس السنة الميلادية",
"Labour Day": "عيد العمال",
"Eid al-Fitr": "عيد الفطر المبارك",
"Eid al-Fitr Day 2": "عيد الفطر المبارك",
"Eid al-Fitr Day 3": "عيد الفطر المبارك",
"Eid al-Adha": "عيد الأضحى المبارك",
"Eid al-Adha Day 2": "عيد الأضحى المبارك",
"Eid al-Adha Day 3": "عيد الأضحى المبارك",
"Islamic New Year": "رأس السنة الهجرية",
"Birthday of the Prophet Muhammad": "المولد النبوي الشريف",
"Arafat Day": "يوم عرفة",
"National Day": "اليوم الوطني",
"National Day 2": "اليوم الوطني",
"Arafat Day 2": "يوم عرفة",
}
10 changes: 0 additions & 10 deletions lang/bangladesh/en/holidays.json

This file was deleted.

33 changes: 0 additions & 33 deletions lang/egypt/en/holidays.json

This file was deleted.

12 changes: 0 additions & 12 deletions lang/iran/fa/holidays.json

This file was deleted.

18 changes: 0 additions & 18 deletions lang/montenegro/sr/holidays.json

This file was deleted.

19 changes: 0 additions & 19 deletions lang/switzerland/de/holidays.json

This file was deleted.

9 changes: 4 additions & 5 deletions src/Concerns/Observable.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,11 @@ protected function observedChristmasDay(int $year): ?CarbonInterface

protected function observedBoxingDay(int $year): ?CarbonInterface
{
$christmasDay = (new CarbonImmutable($year.'-12-25'))->startOfDay();
$boxingDay = $christmasDay->addDay();
$boxingDay = (new CarbonImmutable($year.'-12-26'))->startOfDay();

return match ($christmasDay->dayName) {
'Friday' => $boxingDay->next('monday'),
'Saturday' => $boxingDay->next('tuesday'),
return match ($boxingDay->dayName) {
'Saturday' => $boxingDay->next('monday'),
'Sunday' => $boxingDay->next('tuesday'),
default => null,
};
}
Expand Down
7 changes: 6 additions & 1 deletion src/Concerns/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@

trait Translatable
{
protected function translate(string $country, string $name, ?string $locale = null): string
public function translate(string $country, string $name, ?string $locale = null): string
{
if ($locale === null) {
return $name;

}

if ($locale === $this->defaultLocale()) {
return $name;
}

$countryName = strtolower($country);
Expand Down
10 changes: 10 additions & 0 deletions src/Contracts/HasTranslations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Spatie\Holidays\Contracts;

interface HasTranslations
{
public function defaultLocale(): string;

public function translate(string $country, string $name, ?string $locale = null): string;
}
11 changes: 10 additions & 1 deletion src/Countries/Albania.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@
namespace Spatie\Holidays\Countries;

use Carbon\CarbonImmutable;
use Spatie\Holidays\Concerns\Translatable;
use Spatie\Holidays\Contracts\HasTranslations;
use Spatie\Holidays\Exceptions\InvalidYear;

class Albania extends Country
class Albania extends Country implements HasTranslations
{
use Translatable;

public function countryCode(): string
{
return 'al';
}

public function defaultLocale(): string
{
return 'al';
}

protected function allHolidays(int $year): array
{
return array_merge([
Expand Down
12 changes: 10 additions & 2 deletions src/Countries/Azerbaijan.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@
namespace Spatie\Holidays\Countries;

use Carbon\CarbonImmutable;
use Spatie\Holidays\Concerns\Translatable;
use Spatie\Holidays\Contracts\HasTranslations;

class Azerbaijan extends Country
class Azerbaijan extends Country implements HasTranslations
{
use Translatable;

public function countryCode(): string
{
return 'az';
}

public function defaultLocale(): string
{
return 'az';
}

protected function allHolidays(int $year): array
{
return array_merge([
Expand All @@ -31,7 +40,6 @@ protected function allHolidays(int $year): array
/** @return array<string, CarbonImmutable> */
protected function variableHolidays(int $year): array
{
// does not change according to the standard
return [];
}
}
Loading

0 comments on commit 404e998

Please sign in to comment.