From 1e6120f7f86f1edd7620f4265c702466cb581248 Mon Sep 17 00:00:00 2001 From: Keyzz Rivas Date: Sat, 5 Oct 2024 17:16:31 -0400 Subject: [PATCH 1/2] Implement es-SV culture --- README.md | 1 + .../CultureStrategies/ES_SVHolidayStrategy.cs | 78 +++++++++++++++++++ .../WorkingDays/HolidayNames.Designer.cs | 39 +++++++++- .../WorkingDays/HolidayNames.es.resx | 18 ++++- .../WorkingDays/HolidayNames.resx | 12 +++ 5 files changed, 143 insertions(+), 5 deletions(-) create mode 100644 src/DateTimeExtensions/WorkingDays/CultureStrategies/ES_SVHolidayStrategy.cs diff --git a/README.md b/README.md index 46fe3204..0f736d94 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ Available CultureInfo implementations: | kr-KR | zh-CN | | pl-PL | vi-VN | | es-CO | ro-RO | +| es-SV | | If your culture is not listed here you can contribute it!!! diff --git a/src/DateTimeExtensions/WorkingDays/CultureStrategies/ES_SVHolidayStrategy.cs b/src/DateTimeExtensions/WorkingDays/CultureStrategies/ES_SVHolidayStrategy.cs new file mode 100644 index 00000000..c099282a --- /dev/null +++ b/src/DateTimeExtensions/WorkingDays/CultureStrategies/ES_SVHolidayStrategy.cs @@ -0,0 +1,78 @@ +using DateTimeExtensions.Common; + +namespace DateTimeExtensions.WorkingDays.CultureStrategies +{ + [Locale("es-SV")] + public class ES_SVHolidayStrategy : HolidayStrategyBase, IHolidayStrategy + { + public ES_SVHolidayStrategy() + { + this.InnerHolidays.Add(GlobalHolidays.NewYear); + this.InnerHolidays.Add(ChristianHolidays.MaundyThursday); + this.InnerHolidays.Add(ChristianHolidays.GoodFriday); + this.InnerHolidays.Add(ChristianHolidays.EasterSaturday); + this.InnerHolidays.Add(GlobalHolidays.InternationalWorkersDay); + this.InnerHolidays.Add(MothersDay); + this.InnerHolidays.Add(FathersDay); + this.InnerHolidays.Add(DivineSaviourOfTheWorld); + this.InnerHolidays.Add(ChristianHolidays.DayOfTheDead); + this.InnerHolidays.Add(ChristianHolidays.Christmas); + } + + private static Holiday _mothersDay; + private static Holiday _fathersDay; + private static Holiday _divineSaviourOfTheWorld; + private static Holiday _independenceDay; + + public static Holiday MothersDay + { + get + { + if (_mothersDay == null) + { + _mothersDay = new FixedHoliday("Mother's Day", 5, 10); + } + + return _mothersDay; + } + } + public static Holiday FathersDay + { + get + { + if (_fathersDay == null) + { + _fathersDay = new FixedHoliday("Father's Day", 6, 17); + } + + return _fathersDay; + } + } + + public static Holiday DivineSaviourOfTheWorld + { + get + { + if (_divineSaviourOfTheWorld == null) + { + _divineSaviourOfTheWorld = new FixedHoliday("Divine Saviour of the World", 8, 6); + } + + return _divineSaviourOfTheWorld; + } + } + + public static Holiday IndependenceDay + { + get + { + if (_independenceDay == null) + { + _independenceDay = new FixedHoliday("Independence Day", 9, 15); + } + + return _independenceDay; + } + } + } +} diff --git a/src/DateTimeExtensions/WorkingDays/HolidayNames.Designer.cs b/src/DateTimeExtensions/WorkingDays/HolidayNames.Designer.cs index 19e1c934..754955e4 100644 --- a/src/DateTimeExtensions/WorkingDays/HolidayNames.Designer.cs +++ b/src/DateTimeExtensions/WorkingDays/HolidayNames.Designer.cs @@ -10,7 +10,6 @@ namespace DateTimeExtensions.WorkingDays { using System; - using System.Reflection; /// @@ -40,7 +39,7 @@ internal HolidayNames() { public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DateTimeExtensions.WorkingDays.HolidayNames", typeof(HolidayNames).GetTypeInfo().Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DateTimeExtensions.WorkingDays.HolidayNames", typeof(HolidayNames).Assembly); resourceMan = temp; } return resourceMan; @@ -133,6 +132,15 @@ public static string DayOfTheDead { } } + /// + /// Looks up a localized string similar to Divine Saviour of the World. + /// + public static string Divine_Saviour_of_the_World { + get { + return ResourceManager.GetString("Divine Saviour of the World", resourceCulture); + } + } + /// /// Looks up a localized string similar to Easter. /// @@ -187,6 +195,15 @@ public static string Espanha_NationalDay { } } + /// + /// Looks up a localized string similar to Father's Day. + /// + public static string Father_s_Day { + get { + return ResourceManager.GetString("Father\'s Day", resourceCulture); + } + } + /// /// Looks up a localized string similar to German Unity Day. /// @@ -223,6 +240,15 @@ public static string IndependanceDay { } } + /// + /// Looks up a localized string similar to Independence Day. + /// + public static string Independence_Day { + get { + return ResourceManager.GetString("Independence Day", resourceCulture); + } + } + /// /// Looks up a localized string similar to International Workers' day. /// @@ -250,6 +276,15 @@ public static string MayDay { } } + /// + /// Looks up a localized string similar to Mother's Day. + /// + public static string Mother_s_Day { + get { + return ResourceManager.GetString("Mother\'s Day", resourceCulture); + } + } + /// /// Looks up a localized string similar to New Year. /// diff --git a/src/DateTimeExtensions/WorkingDays/HolidayNames.es.resx b/src/DateTimeExtensions/WorkingDays/HolidayNames.es.resx index 0219fec7..daec74ea 100644 --- a/src/DateTimeExtensions/WorkingDays/HolidayNames.es.resx +++ b/src/DateTimeExtensions/WorkingDays/HolidayNames.es.resx @@ -112,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Todos los Santos @@ -127,11 +127,14 @@ Carnaval - Natividad + Navidad Corpus Cristi + + Divino Salvador del Mundo + Pascua @@ -147,18 +150,27 @@ Fiesta Nacional de España + + Día del padre + Viernes Santo La Inmaculada Concepción + + Día de la Independencia + Fiesta del Trabajo Jueves Santo + + Día de la madre + Año Nuevo diff --git a/src/DateTimeExtensions/WorkingDays/HolidayNames.resx b/src/DateTimeExtensions/WorkingDays/HolidayNames.resx index 49b9dc3b..7743e329 100644 --- a/src/DateTimeExtensions/WorkingDays/HolidayNames.resx +++ b/src/DateTimeExtensions/WorkingDays/HolidayNames.resx @@ -141,6 +141,9 @@ Day of the Dead + + Divine Saviour of the World + Easter @@ -159,6 +162,9 @@ National Day + + Father's Day + German Unity Day @@ -171,6 +177,9 @@ Independance Day + + Independence Day + International Workers' day @@ -180,6 +189,9 @@ May Day + + Mother's Day + New Year From f3b5f4340d3c5c66f9374114743131cc7195d7bf Mon Sep 17 00:00:00 2001 From: Keyzz Rivas Date: Mon, 7 Oct 2024 10:48:30 -0400 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A7=AA=20Update=20christmas=20name=20?= =?UTF-8?q?in=20es-ES?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HolidaysTranslations/SpanishHolidaysNamesTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/DateTimeExtensions.Tests/HolidaysTranslations/SpanishHolidaysNamesTest.cs b/tests/DateTimeExtensions.Tests/HolidaysTranslations/SpanishHolidaysNamesTest.cs index 1fbd25bd..e50de4d5 100644 --- a/tests/DateTimeExtensions.Tests/HolidaysTranslations/SpanishHolidaysNamesTest.cs +++ b/tests/DateTimeExtensions.Tests/HolidaysTranslations/SpanishHolidaysNamesTest.cs @@ -32,7 +32,7 @@ public void AssertSpanishHolidaysAreTranslated() Assert.AreEqual(ES_ESHolidayStrategy.NationalDay.Name, "Fiesta Nacional de España"); Assert.AreEqual(ES_ESHolidayStrategy.ConstitutionDay.Name, "Día de la Constitución"); - Assert.AreEqual(ChristianHolidays.Christmas.Name, "Natividad"); + Assert.AreEqual(ChristianHolidays.Christmas.Name, "Navidad"); Assert.AreEqual(GlobalHolidays.NewYear.Name, "Año Nuevo"); Assert.AreEqual(ChristianHolidays.Epiphany.Name, "Epifanía del Señor"); Assert.AreEqual(ChristianHolidays.Carnival.Name, "Carnaval");