Skip to content

Commit

Permalink
Simplify TimeSpanHumanize_Multiple* resources (#1427)
Browse files Browse the repository at this point in the history
  • Loading branch information
hazzik authored Feb 22, 2024
1 parent aeb7e39 commit 0cd8c50
Show file tree
Hide file tree
Showing 16 changed files with 194 additions and 1,049 deletions.
7 changes: 4 additions & 3 deletions src/Humanizer/Localisation/Formatters/CroatianFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ namespace Humanizer
class CroatianFormatter() :
DefaultFormatter("hr")
{
const string DualTrialQuadralPostfix = "_DualTrialQuadral";
const string PaucalPostfix = "_Paucal";

protected override string GetResourceKey(string resourceKey, int number)
{
if ((number % 10 == 2 || number % 10 == 3 || number % 10 == 4) && number != 12 && number != 13 && number != 14)
var mod10 = number % 10;
if (mod10 is > 1 and < 5 && number != 12 && number != 13 && number != 14)
{
return resourceKey + DualTrialQuadralPostfix;
return resourceKey + PaucalPostfix;
}

return resourceKey;
Expand Down
1 change: 0 additions & 1 deletion src/Humanizer/Localisation/Formatters/SerbianFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class SerbianFormatter(string localeCode) :
protected override string GetResourceKey(string resourceKey, int number)
{
var mod10 = number % 10;

if (mod10 is > 1 and < 5)
{
return resourceKey + PaucalPostfix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class SlovenianFormatter() :
DefaultFormatter("sl")
{
const string DualPostfix = "_Dual";
const string TrialQuadralPostfix = "_TrialQuadral";
const string TrialQuadralPostfix = "_Paucal";

protected override string GetResourceKey(string resourceKey, int number)
{
Expand Down
172 changes: 17 additions & 155 deletions src/Humanizer/Properties/Resources.es.resx
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,6 @@
<data name="TimeSpanHumanize_SingleYear_Words" xml:space="preserve">
<value>un año</value>
</data>
<data name="TimeSpanHumanize_MultipleDays_DualTrialQuadral" xml:space="preserve">
<value>{0} días</value>
</data>
<data name="N" xml:space="preserve">
<value>norte</value>
</data>
Expand Down Expand Up @@ -315,67 +312,61 @@
<data name="WNW" xml:space="preserve">
<value>oeste-noroeste</value>
</data>
<data name="TimeSpanHumanize_MultipleYears_TrialQuadral" xml:space="preserve">
<value>{0} años</value>
</data>
<data name="TimeSpanHumanize_MultipleYears_Singular" xml:space="preserve">
<value>{0} año</value>
</data>
<data name="TimeSpanHumanize_MultipleYears_Plural" xml:space="preserve">
<value>{0} años</value>
</data>
<data name="TimeSpanHumanize_MultipleYears_DualTrialQuadral" xml:space="preserve">
<data name="TimeSpanHumanize_MultipleYears_Paucal" xml:space="preserve">
<value>{0} años</value>
</data>
<data name="TimeSpanHumanize_MultipleWeeks_Singular" xml:space="preserve">
<value>{0} semana</value>
</data>
<data name="TimeSpanHumanize_MultipleWeeks_TrialQuadral" xml:space="preserve">
<value>{0} semanas</value>
</data>
<data name="DateHumanize_MultipleHoursAgo_DualTrialQuadral" xml:space="preserve">
<data name="DateHumanize_MultipleHoursAgo_Paucal" xml:space="preserve">
<value>hace {0} horas</value>
</data>
<data name="DateHumanize_MultipleHoursFromNow_DualTrialQuadral" xml:space="preserve">
<data name="DateHumanize_MultipleHoursFromNow_Paucal" xml:space="preserve">
<value>hace {0} horas desde ahora</value>
</data>
<data name="DateHumanize_MultipleMinutesAgo_DualTrialQuadral" xml:space="preserve">
<data name="DateHumanize_MultipleMinutesAgo_Paucal" xml:space="preserve">
<value>hace {0} minutos</value>
</data>
<data name="DateHumanize_MultipleMinutesFromNow_DualTrialQuadral" xml:space="preserve">
<data name="DateHumanize_MultipleMinutesFromNow_Paucal" xml:space="preserve">
<value>hace {0} minutos desde ahora</value>
</data>
<data name="DateHumanize_MultipleMonthsAgo_DualTrialQuadral" xml:space="preserve">
<data name="DateHumanize_MultipleMonthsAgo_Paucal" xml:space="preserve">
<value>hace {0} meses</value>
</data>
<data name="DateHumanize_MultipleMonthsFromNow_DualTrialQuadral" xml:space="preserve">
<data name="DateHumanize_MultipleMonthsFromNow_Paucal" xml:space="preserve">
<value>hace {0} meses desde ahora</value>
</data>
<data name="DateHumanize_MultipleSecondsAgo_DualTrialQuadral" xml:space="preserve">
<data name="DateHumanize_MultipleSecondsAgo_Paucal" xml:space="preserve">
<value>hace {0} segundos</value>
</data>
<data name="DateHumanize_MultipleSecondsFromNow_DualTrialQuadral" xml:space="preserve">
<data name="DateHumanize_MultipleSecondsFromNow_Paucal" xml:space="preserve">
<value>hace {0} segundos desde ahora</value>
</data>
<data name="DateHumanize_MultipleYearsAgo_DualTrialQuadral" xml:space="preserve">
<data name="DateHumanize_MultipleYearsAgo_Paucal" xml:space="preserve">
<value>hace {0} años</value>
</data>
<data name="NW" xml:space="preserve">
<value>noroeste</value>
</data>
<data name="DateHumanize_MultipleYearsFromNow_DualTrialQuadral" xml:space="preserve">
<data name="DateHumanize_MultipleYearsFromNow_Paucal" xml:space="preserve">
<value>hace {0} años desde ahora</value>
</data>
<data name="TimeSpanHumanize_MultipleMilliseconds_DualTrialQuadral" xml:space="preserve">
<data name="TimeSpanHumanize_MultipleMilliseconds_Paucal" xml:space="preserve">
<value>{0} milisegundos</value>
</data>
<data name="TimeSpanHumanize_MultipleMinutes_DualTrialQuadral" xml:space="preserve">
<data name="TimeSpanHumanize_MultipleMinutes_Paucal" xml:space="preserve">
<value>{0} minutos</value>
</data>
<data name="TimeSpanHumanize_MultipleSeconds_DualTrialQuadral" xml:space="preserve">
<data name="TimeSpanHumanize_MultipleSeconds_Paucal" xml:space="preserve">
<value>{0} segundos</value>
</data>
<data name="TimeSpanHumanize_MultipleWeeks_DualTrialQuadral" xml:space="preserve">
<data name="TimeSpanHumanize_MultipleWeeks_Paucal" xml:space="preserve">
<value>{0} semanas</value>
</data>
<data name="DateHumanize_Never" xml:space="preserve">
Expand All @@ -384,7 +375,7 @@
<data name="TimeSpanHumanize_MultipleMonths_Dual" xml:space="preserve">
<value>{0} meses</value>
</data>
<data name="TimeSpanHumanize_MultipleMonths_DualTrialQuadral" xml:space="preserve">
<data name="TimeSpanHumanize_MultipleMonths_Paucal" xml:space="preserve">
<value>{0} meses</value>
</data>
<data name="TimeSpanHumanize_MultipleMonths_Plural" xml:space="preserve">
Expand All @@ -393,13 +384,10 @@
<data name="TimeSpanHumanize_MultipleMonths_Singular" xml:space="preserve">
<value>{0} mes</value>
</data>
<data name="TimeSpanHumanize_MultipleMonths_TrialQuadral" xml:space="preserve">
<value>{0} meses</value>
</data>
<data name="TimeSpanHumanize_MultipleYears_Dual" xml:space="preserve">
<value>{0} años</value>
</data>
<data name="TimeSpanHumanize_MultipleHours_DualTrialQuadral" xml:space="preserve">
<data name="TimeSpanHumanize_MultipleHours_Paucal" xml:space="preserve">
<value>{0} horas</value>
</data>
<data name="NNW" xml:space="preserve">
Expand Down Expand Up @@ -522,12 +510,6 @@
<data name="DateHumanize_MultipleDaysFromNow_Singular" xml:space="preserve">
<value>{0} día desde ahora</value>
</data>
<data name="DateHumanize_MultipleDaysFromNow_TrialQuadral" xml:space="preserve">
<value>{0} días desde ahora</value>
</data>
<data name="DateHumanize_MultipleHoursAgo_Above20" xml:space="preserve">
<value>hace {0} horas</value>
</data>
<data name="DateHumanize_MultipleHoursAgo_Dual" xml:space="preserve">
<value>hace {0} horas</value>
</data>
Expand All @@ -537,21 +519,12 @@
<data name="DateHumanize_MultipleHoursAgo_Singular" xml:space="preserve">
<value>hace {0} hora</value>
</data>
<data name="DateHumanize_MultipleHoursAgo_TrialQuadral" xml:space="preserve">
<value>hace {0} horas</value>
</data>
<data name="DateHumanize_MultipleHoursFromNow_Plural" xml:space="preserve">
<value>hace {0} horas desde ahora</value>
</data>
<data name="DateHumanize_MultipleHoursFromNow_Singular" xml:space="preserve">
<value>hace {0} hora desde ahora</value>
</data>
<data name="DateHumanize_MultipleHoursFromNow_TrialQuadral" xml:space="preserve">
<value>hace {0} horas desde ahora</value>
</data>
<data name="DateHumanize_MultipleMinutesAgo_Above20" xml:space="preserve">
<value>hace {0} minutos</value>
</data>
<data name="DateHumanize_MultipleMinutesAgo_Dual" xml:space="preserve">
<value>hace {0} minutos</value>
</data>
Expand All @@ -561,18 +534,9 @@
<data name="DateHumanize_MultipleMinutesAgo_Singular" xml:space="preserve">
<value>hace {0} minuto</value>
</data>
<data name="DateHumanize_MultipleMinutesAgo_TrialQuadral" xml:space="preserve">
<value>hace {0} minutos</value>
</data>
<data name="DateHumanize_MultipleDaysFromNow_Plural" xml:space="preserve">
<value>hace {0} días desde ahora</value>
</data>
<data name="TimeSpanHumanize_MultipleSeconds_TrialQuadral" xml:space="preserve">
<value>{0} segundos</value>
</data>
<data name="DateHumanize_MultipleDaysAgo_TrialQuadral" xml:space="preserve">
<value>hace {0} días</value>
</data>
<data name="DateHumanize_MultipleDaysAgo_Singular" xml:space="preserve">
<value>hace {0} día</value>
</data>
Expand Down Expand Up @@ -615,9 +579,6 @@
<data name="TimeSpanHumanize_MultipleMilliseconds_Plural" xml:space="preserve">
<value>{0} milisegundos</value>
</data>
<data name="DateHumanize_MultipleDaysAgo_Above20" xml:space="preserve">
<value>hace {0} días</value>
</data>
<data name="DateHumanize_MultipleDaysAgo_Dual" xml:space="preserve">
<value>hace {0} días</value>
</data>
Expand All @@ -636,48 +597,27 @@
<data name="DateHumanize_MultipleMonthsAgo_Dual" xml:space="preserve">
<value>hace {0} meses desde ahora</value>
</data>
<data name="DateHumanize_MultipleYearsAgo_TrialQuadral" xml:space="preserve">
<value>hace {0} años</value>
</data>
<data name="DateHumanize_MultipleYearsFromNow_Plural" xml:space="preserve">
<value>hace {0} años desde ahora</value>
</data>
<data name="DateHumanize_MultipleYearsFromNow_Singular" xml:space="preserve">
<value>hace {0} año desde ahora</value>
</data>
<data name="DateHumanize_MultipleYearsFromNow_TrialQuadral" xml:space="preserve">
<value>hace {0} años desde ahora</value>
</data>
<data name="TimeSpanHumanize_MultipleDays_Singular" xml:space="preserve">
<value>{0} día</value>
</data>
<data name="TimeSpanHumanize_MultipleDays_TrialQuadral" xml:space="preserve">
<value>{0} días</value>
</data>
<data name="DateHumanize_MultipleYearsAgo_Singular" xml:space="preserve">
<value>hace {0} año</value>
</data>
<data name="TimeSpanHumanize_MultipleHours_Dual" xml:space="preserve">
<value>{0} horas</value>
</data>
<data name="TimeSpanHumanize_MultipleHours_TrialQuadral" xml:space="preserve">
<value>{0} horas</value>
</data>
<data name="TimeSpanHumanize_MultipleMilliseconds_TrialQuadral" xml:space="preserve">
<value>{0} milisegundos</value>
</data>
<data name="TimeSpanHumanize_MultipleMinutes_Singular" xml:space="preserve">
<value>{0} minuto</value>
</data>
<data name="TimeSpanHumanize_MultipleMinutes_TrialQuadral" xml:space="preserve">
<value>{0} minutos</value>
</data>
<data name="TimeSpanHumanize_MultipleSeconds_Dual" xml:space="preserve">
<value>{0} segundos</value>
</data>
<data name="DateHumanize_MultipleMinutesFromNow_TrialQuadral" xml:space="preserve">
<value>hace {0} desde ahora</value>
</data>
<data name="TimeSpanHumanize_MultipleHours_Singular" xml:space="preserve">
<value>{0} hora</value>
</data>
Expand All @@ -687,18 +627,12 @@
<data name="TimeSpanHumanize_MultipleMilliseconds_Singular" xml:space="preserve">
<value>{0} milisegundo</value>
</data>
<data name="DateHumanize_MultipleYearsAgo_Above20" xml:space="preserve">
<value>hace {0} años</value>
</data>
<data name="DateHumanize_MultipleYearsAgo_Dual" xml:space="preserve">
<value>hace {0} años</value>
</data>
<data name="DateHumanize_MultipleMonthsAgo_Singular" xml:space="preserve">
<value>hace {0} meses</value>
</data>
<data name="DateHumanize_MultipleMonthsAgo_TrialQuadral" xml:space="preserve">
<value>hace {0} meses</value>
</data>
<data name="DateHumanize_MultipleMonthsFromNow_Dual" xml:space="preserve">
<value>hace {0} meses desde ahora</value>
</data>
Expand All @@ -708,91 +642,19 @@
<data name="DateHumanize_MultipleMonthsFromNow_Singular" xml:space="preserve">
<value>hace {0} mes desde ahora</value>
</data>
<data name="DateHumanize_MultipleMonthsFromNow_TrialQuadral" xml:space="preserve">
<value>hace {0} meses desde ahora</value>
</data>
<data name="DateHumanize_MultipleMonthsAgo_Plural" xml:space="preserve">
<value>hace {0} meses</value>
</data>
<data name="DateHumanize_MultipleSecondsAgo_Plural" xml:space="preserve">
<value>hace {0} segundos</value>
</data>
<data name="DateHumanize_MultipleSecondsAgo_Above20" xml:space="preserve">
<value>hace {0} segundos</value>
</data>
<data name="DateHumanize_MultipleSecondsFromNow_TrialQuadral" xml:space="preserve">
<value>hace {0} segundos desde ahora</value>
</data>
<data name="DateHumanize_MultipleSecondsFromNow_Plural" xml:space="preserve">
<value>hace {0} segundos desde ahora</value>
</data>
<data name="DateHumanize_MultipleSecondsAgo_TrialQuadral" xml:space="preserve">
<value>hace {0} segundos</value>
</data>
<data name="DateHumanize_MultipleSecondsFromNow_Singular" xml:space="preserve">
<value>hace {0} segundo desde ahora</value>
</data>
<data name="DateHumanize_MultipleSecondsAgo_Singular" xml:space="preserve">
<value>hace {0} segundo</value>
</data>
<data name="DateHumanize_MultipleDaysAgo_Paucal" xml:space="preserve">
<value>hace unos pocos días</value>
</data>
<data name="DateHumanize_MultipleDaysFromNow_Paucal" xml:space="preserve">
<value>hace unos pocos días desde hoy</value>
</data>
<data name="DateHumanize_MultipleHoursAgo_Paucal" xml:space="preserve">
<value>hace unas pocas horas</value>
</data>
<data name="DateHumanize_MultipleHoursFromNow_Paucal" xml:space="preserve">
<value>hace unas pocas horas desde ahora</value>
</data>
<data name="DateHumanize_MultipleMinutesAgo_Paucal" xml:space="preserve">
<value>hace unos pocos minutos</value>
</data>
<data name="DateHumanize_MultipleMinutesFromNow_Paucal" xml:space="preserve">
<value>hace unos pocos minutos desde ahora</value>
</data>
<data name="DateHumanize_MultipleMonthsAgo_Paucal" xml:space="preserve">
<value>hace unos pocos meses</value>
</data>
<data name="DateHumanize_MultipleMonthsFromNow_Paucal" xml:space="preserve">
<value>hace unos pocos meses desde ahora</value>
</data>
<data name="DateHumanize_MultipleSecondsAgo_Paucal" xml:space="preserve">
<value>hace unos pocos segundos</value>
</data>
<data name="DateHumanize_MultipleSecondsFromNow_Paucal" xml:space="preserve">
<value>hace unos pocos segundos desde ahora</value>
</data>
<data name="DateHumanize_MultipleYearsAgo_Paucal" xml:space="preserve">
<value>hace unos pocos años</value>
</data>
<data name="DateHumanize_MultipleYearsFromNow_Paucal" xml:space="preserve">
<value>hace unos pocos años desde ahora</value>
</data>
<data name="TimeSpanHumanize_MultipleDays_Paucal" xml:space="preserve">
<value>pocos días</value>
</data>
<data name="TimeSpanHumanize_MultipleHours_Paucal" xml:space="preserve">
<value>pocas horas</value>
</data>
<data name="TimeSpanHumanize_MultipleMilliseconds_Paucal" xml:space="preserve">
<value>pocos milisegundos</value>
</data>
<data name="TimeSpanHumanize_MultipleMinutes_Paucal" xml:space="preserve">
<value>pocos minutos</value>
</data>
<data name="TimeSpanHumanize_MultipleMonths_Paucal" xml:space="preserve">
<value>pocos meses</value>
</data>
<data name="TimeSpanHumanize_MultipleSeconds_Paucal" xml:space="preserve">
<value>pocos segundos</value>
</data>
<data name="TimeSpanHumanize_MultipleWeeks_Paucal" xml:space="preserve">
<value>pocas semanas</value>
</data>
<data name="TimeSpanHumanize_MultipleYears_Paucal" xml:space="preserve">
<value>pocos años</value>
</data>
</root>
Loading

0 comments on commit 0cd8c50

Please sign in to comment.