From 274ffefe7e35e4182b846751d15257737f0215d3 Mon Sep 17 00:00:00 2001 From: Stefano Date: Fri, 8 Nov 2024 18:57:26 +0100 Subject: [PATCH 1/2] Added italian natural time strategy --- .../IT_ITNaturalTimeStrategy.cs | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/DateTimeExtensions/NaturalText/CultureStrategies/IT_ITNaturalTimeStrategy.cs diff --git a/src/DateTimeExtensions/NaturalText/CultureStrategies/IT_ITNaturalTimeStrategy.cs b/src/DateTimeExtensions/NaturalText/CultureStrategies/IT_ITNaturalTimeStrategy.cs new file mode 100644 index 0000000..6d0461c --- /dev/null +++ b/src/DateTimeExtensions/NaturalText/CultureStrategies/IT_ITNaturalTimeStrategy.cs @@ -0,0 +1,70 @@ +#region License + +// +// Copyright (c) 2011-2012, João Matos Silva +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#endregion + +using DateTimeExtensions.Common; + +namespace DateTimeExtensions.NaturalText.CultureStrategies +{ + [Locale("it-IT")] + public class IT_ITNaturalTimeStrategy : NaturalTimeStrategyBase + { + protected override string YearText + { + get { return "Anno"; } + } + + protected override string MonthText + { + get { return "Mese"; } + } + + protected override string DayText + { + get { return "Giorno"; } + } + + protected override string HourText + { + get { return "Ora"; } + } + + protected override string MinuteText + { + get { return "Minuto"; } + } + + protected override string SecondText + { + get { return "Secondo"; } + } + + protected override string Pluralize(string text, int value) + { + // referring to hours + if (text.EndsWith("a")) + { + return text + "e"; + } + + // referring to years, months, days, minutes and seconds + return text + "i"; + } + } +} \ No newline at end of file From 3bba251bc71f4daff89530a60dc3841b755d96ab Mon Sep 17 00:00:00 2001 From: Stefano Date: Sun, 10 Nov 2024 23:08:22 +0100 Subject: [PATCH 2/2] Update IT_ITNaturalTimeStrategy.cs --- .../CultureStrategies/IT_ITNaturalTimeStrategy.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DateTimeExtensions/NaturalText/CultureStrategies/IT_ITNaturalTimeStrategy.cs b/src/DateTimeExtensions/NaturalText/CultureStrategies/IT_ITNaturalTimeStrategy.cs index 6d0461c..d7c762f 100644 --- a/src/DateTimeExtensions/NaturalText/CultureStrategies/IT_ITNaturalTimeStrategy.cs +++ b/src/DateTimeExtensions/NaturalText/CultureStrategies/IT_ITNaturalTimeStrategy.cs @@ -1,7 +1,7 @@ #region License // -// Copyright (c) 2011-2012, João Matos Silva +// Copyright (c) 2011-2012, Jo�o Matos Silva // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -60,11 +60,11 @@ protected override string Pluralize(string text, int value) // referring to hours if (text.EndsWith("a")) { - return text + "e"; + return text.Remove(text.Length -1, 1) + "e"; } // referring to years, months, days, minutes and seconds - return text + "i"; + return text.Remove(text.Length -1, 1) + "i"; } } } \ No newline at end of file