From 9f7561b3ed0ebb0a00f1cfb1d11c822d4edb8db4 Mon Sep 17 00:00:00 2001 From: abdalrhman ak Date: Sun, 4 Feb 2024 23:08:32 +0300 Subject: [PATCH] Adding holidays for syria --- lang/syria/ar/holidays.json | 16 +++++ src/Countries/Syria.php | 40 +++++++++++++ .../it_can_calculate_syria_holidays.snap | 58 +++++++++++++++++++ ..._translate_syria_holidays_into_arabic.snap | 58 +++++++++++++++++++ tests/Countries/SyriaTest.php | 26 +++++++++ 5 files changed, 198 insertions(+) create mode 100644 lang/syria/ar/holidays.json create mode 100644 src/Countries/Syria.php create mode 100644 tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syria_holidays.snap create mode 100644 tests/.pest/snapshots/Countries/SyriaTest/it_can_translate_syria_holidays_into_arabic.snap create mode 100644 tests/Countries/SyriaTest.php diff --git a/lang/syria/ar/holidays.json b/lang/syria/ar/holidays.json new file mode 100644 index 000000000..cb5d1724c --- /dev/null +++ b/lang/syria/ar/holidays.json @@ -0,0 +1,16 @@ +{ + "New Year\n's Day": "يوم رأس السنة", + "Mother\n's Day": "عيد الأم", + "Teacher\n's Day": "عيد المعلم", + "Western Easter": "عيد الفصح الغربي", + "Eid al-Fitr": "عيد الفطر السعيد", + "Syrian Independence Day": "عيد الجلا واستقلال سورية", + "Labor Day": "عيد العمال", + "Eastern Easter": "عيد الفصح الشرقي", + "Martyrs\n's Day": "عيد الشهداء", + "Eid al-Adha": "عيد الأضحى المبارك", + "Islamic New Year": "عيد رأس السنة الهجرية", + "The commemoration of the birth of the Prophet Muhammad": "عيد مولد الرسول الأعظم", + "The October Liberation War": "ذكرى حرب تشرين التحريرية", + "Merry Christmas": "عيد الميلاد المجيد" +} diff --git a/src/Countries/Syria.php b/src/Countries/Syria.php new file mode 100644 index 000000000..cfc6b15c8 --- /dev/null +++ b/src/Countries/Syria.php @@ -0,0 +1,40 @@ + '01-01', + 'Mother\'s Day' => '03-21', + 'Teacher\'s Day' => '03-21', + 'Western Easter' => '03-31', + 'Eid al-Fitr' => '04-10', + 'Syrian Independence Day' => '04-17', + 'Labor Day' => '05-01', + 'Eastern Easter' => '05-05', + 'Martyrs\'s Day' => '05-06', + 'Eid al-Adha' => '06-16', + 'Islamic New Year' => '07-07', + 'The commemoration of the birth of the Prophet Muhammad' => '09-15', + 'The October Liberation War' => '10-06', + 'Merry Christmas' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + // The variable holidays all follow the lunar calendar, so their dates are not confirmed. + return []; + } +} diff --git a/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syria_holidays.snap b/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syria_holidays.snap new file mode 100644 index 000000000..f5c532b2d --- /dev/null +++ b/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syria_holidays.snap @@ -0,0 +1,58 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Mother's Day", + "date": "2024-03-21" + }, + { + "name": "Teacher's Day", + "date": "2024-03-21" + }, + { + "name": "Western Easter", + "date": "2024-03-31" + }, + { + "name": "Eid al-Fitr", + "date": "2024-04-10" + }, + { + "name": "Syrian Independence Day", + "date": "2024-04-17" + }, + { + "name": "Labor Day", + "date": "2024-05-01" + }, + { + "name": "Eastern Easter", + "date": "2024-05-05" + }, + { + "name": "Martyrs's Day", + "date": "2024-05-06" + }, + { + "name": "Eid al-Adha", + "date": "2024-06-16" + }, + { + "name": "Islamic New Year", + "date": "2024-07-07" + }, + { + "name": "The commemoration of the birth of the Prophet Muhammad", + "date": "2024-09-15" + }, + { + "name": "The October Liberation War", + "date": "2024-10-06" + }, + { + "name": "Merry Christmas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SyriaTest/it_can_translate_syria_holidays_into_arabic.snap b/tests/.pest/snapshots/Countries/SyriaTest/it_can_translate_syria_holidays_into_arabic.snap new file mode 100644 index 000000000..3c3ccf9c5 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SyriaTest/it_can_translate_syria_holidays_into_arabic.snap @@ -0,0 +1,58 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Mother's Day", + "date": "2024-03-21" + }, + { + "name": "Teacher's Day", + "date": "2024-03-21" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0641\u0635\u062d \u0627\u0644\u063a\u0631\u0628\u064a", + "date": "2024-03-31" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0641\u0637\u0631 \u0627\u0644\u0633\u0639\u064a\u062f", + "date": "2024-04-10" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u062c\u0644\u0627 \u0648\u0627\u0633\u062a\u0642\u0644\u0627\u0644 \u0633\u0648\u0631\u064a\u0629", + "date": "2024-04-17" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0639\u0645\u0627\u0644", + "date": "2024-05-01" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0641\u0635\u062d \u0627\u0644\u0634\u0631\u0642\u064a", + "date": "2024-05-05" + }, + { + "name": "Martyrs's Day", + "date": "2024-05-06" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0623\u0636\u062d\u0649 \u0627\u0644\u0645\u0628\u0627\u0631\u0643", + "date": "2024-06-16" + }, + { + "name": "\u0639\u064a\u062f \u0631\u0623\u0633 \u0627\u0644\u0633\u0646\u0629 \u0627\u0644\u0647\u062c\u0631\u064a\u0629", + "date": "2024-07-07" + }, + { + "name": "\u0639\u064a\u062f \u0645\u0648\u0644\u062f \u0627\u0644\u0631\u0633\u0648\u0644 \u0627\u0644\u0623\u0639\u0638\u0645", + "date": "2024-09-15" + }, + { + "name": "\u0630\u0643\u0631\u0649 \u062d\u0631\u0628 \u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062a\u062d\u0631\u064a\u0631\u064a\u0629", + "date": "2024-10-06" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0645\u064a\u0644\u0627\u062f \u0627\u0644\u0645\u062c\u064a\u062f", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/SyriaTest.php b/tests/Countries/SyriaTest.php new file mode 100644 index 000000000..6bad45089 --- /dev/null +++ b/tests/Countries/SyriaTest.php @@ -0,0 +1,26 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty() + ->and(formatDates($holidays))->toMatchSnapshot(); +}); +it('can translate syria holidays into arabic', function () { + $holidays = Holidays::for(country: 'sy', locale: 'ar', year: 2024)->get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +});