Skip to content

Commit

Permalink
Germany: Adding local for EN, FR, NL (#183)
Browse files Browse the repository at this point in the history
* Adding germany local for EN, FR, NL

* Adding test for local support

* Update tests/Countries/GermanyTest.php

---------

Co-authored-by: Niels Vanpachtenbeke <[email protected]>
  • Loading branch information
arnebr and Nielsvanpach authored Jan 27, 2024
1 parent 1ecaacb commit 7e912ad
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lang/germany/en/holidays.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"Neujahr": "New Year",
"Heilige Drei Könige": "Epiphany",
"Tag der Arbeit": "Labour Day",
"Himmelfahrt": "Ascension Day",
"Pfingstmontag": "Whit Monday",
"Pfingstsonntag": "Whit Sunday",
"Fronleichnam": "Corpus Christi",
"Mariä Himmelfahrt": "Assumption of Mary",
"Tag der Deutschen Einheit": "German Unity Day",
"Reformationstag": "Reformation Day",
"Allerheiligen": "All Saints' Day",
"Buß- und Bettag": "Repentance and Prayer Day",
"1. Weihnachtstag": "Christmas Day",
"2. Weihnachtstag": "Second Day of Christmas",
"Ostermontag": "Easter Monday",
"Karfreitag": "Good Friday",
"Ostersonntag": "Easter Sunday",
"Internationaler Frauentag": "International Women's Day",
"Weltkindertag": "World Children's Day"
}
21 changes: 21 additions & 0 deletions lang/germany/fr/holidays.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"Neujahr": "Jour de l'An",
"Heilige Drei Könige": "Épiphanie",
"Tag der Arbeit": "Fête du Travail",
"Himmelfahrt": "Ascension",
"Pfingstmontag": "Lundi de Pentecôte",
"Pfingstsonntag": "Dimanche de Pentecôte",
"Fronleichnam": "Fête-Dieu",
"Mariä Himmelfahrt": "Assomption",
"Tag der Deutschen Einheit": "Jour de l'Unité allemande",
"Reformationstag": "Fête de la Réformation",
"Allerheiligen": "Toussaint",
"Buß- und Bettag": "Jour de pénitence et de prières",
"1. Weihnachtstag": "Noël",
"2. Weihnachtstag": "Lendemain de Noël",
"Ostermontag": "Lundi de Pâques",
"Karfreitag": "Vendredi Saint",
"Ostersonntag": "Dimanche de Pâques",
"Internationaler Frauentag": "Journée internationale des femmes",
"Weltkindertag": "Journée de l'enfance"
}
21 changes: 21 additions & 0 deletions lang/germany/nl/holidays.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"Neujahr": "Nieuwjaar",
"Heilige Drei Könige": "Driekoningen",
"Tag der Arbeit": "Dag van de Arbeid",
"Himmelfahrt": "Hemelvaart",
"Pfingstmontag": "Tweede pinksterdag",
"Pfingstsonntag": "Eerste Pinksterdag",
"Fronleichnam": "Sacramentsdag",
"Mariä Himmelfahrt": "Mariahemelvaart",
"Tag der Deutschen Einheit": "Dag van de Duitse eenheid",
"Reformationstag": "Hervormingsdag",
"Allerheiligen": "Allerheiligen",
"Buß- und Bettag": "Boete- en Biddag",
"1. Weihnachtstag": "Eerste kerstdag",
"2. Weihnachtstag": "Tweede kerstdag",
"Ostermontag": "Tweede paasdag",
"Karfreitag": "Goede Vrijdag",
"Ostersonntag": "Eerste paasdag",
"Internationaler Frauentag": "Internationale vrouwendag",
"Weltkindertag": "Kinderdag"
}
15 changes: 15 additions & 0 deletions tests/Countries/GermanyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Carbon\CarbonImmutable;
use Spatie\Holidays\Countries\Germany;
use Spatie\Holidays\Exceptions\InvalidLocale;
use Spatie\Holidays\Holidays;

it('can calculate german holidays', function () {
Expand Down Expand Up @@ -78,3 +79,17 @@
['SH', 10],
['TH', 11]]
);

it('can calculate german holidays in local', function (string $locale, string $newYearsDayName) {
CarbonImmutable::setTestNow('2024-01-01');
$result = Holidays::for(country: 'de', year: 2024, locale: $locale)->get();

expect($result)->toBeArray();
expect($result[0]['name'])->toBe($newYearsDayName);
})->with(
[
['en','New Year'],
['nl','Nieuwjaar'],
['fr','Jour de l\'An']
]
);

0 comments on commit 7e912ad

Please sign in to comment.