diff --git a/release_notes.md b/release_notes.md
index c43e7cf48..1828ce1be 100644
--- a/release_notes.md
+++ b/release_notes.md
@@ -1,5 +1,5 @@
###In Development
-
+- [#146](https://github.com/MehdiK/Humanizer/pull/146): Added Spanish translation for future DateTime, TimeSpan and Now
[Commits](https://github.com/MehdiK/Humanizer/compare/v1.18.1...master)
###v1.18.1 - 2014-04-09
diff --git a/src/Humanizer.Tests/Localisation/es/DateHumanizeTests.cs b/src/Humanizer.Tests/Localisation/es/DateHumanizeTests.cs
index 6bec389d9..ddd890eb1 100644
--- a/src/Humanizer.Tests/Localisation/es/DateHumanizeTests.cs
+++ b/src/Humanizer.Tests/Localisation/es/DateHumanizeTests.cs
@@ -1,4 +1,5 @@
using System;
+using Humanizer.Localisation;
using Xunit;
using Xunit.Extensions;
@@ -9,63 +10,99 @@ public class DateHumanizeTests : AmbientCulture
public DateHumanizeTests() : base("es-ES") { }
[Theory]
- [InlineData(-10, "hace 10 días")]
- [InlineData(-3, "hace 3 días")]
- [InlineData(-2, "hace 2 días")]
- [InlineData(-1, "ayer")]
- public void DaysAgo(int days, string expected)
+ [InlineData(1, "hace un segundo")]
+ [InlineData(2, "hace 2 segundos")]
+ public void SecondsAgo(int seconds, string expected)
{
- Assert.Equal(expected, DateTime.UtcNow.AddDays(days).Humanize());
+ DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past);
}
[Theory]
- [InlineData(-10, "hace 10 horas")]
- [InlineData(-3, "hace 3 horas")]
- [InlineData(-2, "hace 2 horas")]
- [InlineData(-1, "hace una hora")]
- public void HoursAgo(int hours, string expected)
+ [InlineData(1, "en un segundo")]
+ [InlineData(2, "en 2 segundos")]
+ public void SecondsFromNow(int seconds, string expected)
{
- Assert.Equal(expected, DateTime.UtcNow.AddHours(hours).Humanize());
+ DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future);
}
[Theory]
- [InlineData(-10, "hace 10 minutos")]
- [InlineData(-3, "hace 3 minutos")]
- [InlineData(-2, "hace 2 minutos")]
- [InlineData(-1, "hace un minuto")]
- public void MinutesAgo(int minutes, string expected)
+ [InlineData(1, "hace un minuto")]
+ [InlineData(2, "hace 2 minutos")]
+ public void MinutesAgo(int minutes, string expected)
{
- Assert.Equal(expected, DateTime.UtcNow.AddMinutes(minutes).Humanize());
+ DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past);
}
[Theory]
- [InlineData(-10, "hace 10 meses")]
- [InlineData(-3, "hace 3 meses")]
- [InlineData(-2, "hace 2 meses")]
- [InlineData(-1, "hace un mes")]
- public void MonthsAgo(int months, string expected)
+ [InlineData(1, "en un minuto")]
+ [InlineData(2, "en 2 minutos")]
+ public void MinutesFromNow(int minutes, string expected)
{
- Assert.Equal(expected, DateTime.UtcNow.AddMonths(months).Humanize());
+ DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future);
}
[Theory]
- [InlineData(-10, "hace 10 segundos")]
- [InlineData(-3, "hace 3 segundos")]
- [InlineData(-2, "hace 2 segundos")]
- [InlineData(-1, "hace un segundo")]
- public void SecondsAgo(int seconds, string expected)
+ [InlineData(1, "hace una hora")]
+ [InlineData(2, "hace 2 horas")]
+ public void HoursAgo(int hours, string expected)
{
- Assert.Equal(expected, DateTime.UtcNow.AddSeconds(seconds).Humanize());
+ DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past);
}
[Theory]
- [InlineData(-10, "hace 10 años")]
- [InlineData(-3, "hace 3 años")]
- [InlineData(-2, "hace 2 años")]
- [InlineData(-1, "hace un año")]
- public void YearsAgo(int years, string expected)
+ [InlineData(1, "en una hora")]
+ [InlineData(2, "en 2 horas")]
+ public void HoursFromNow(int hours, string expected)
{
- Assert.Equal(expected, DateTime.UtcNow.AddYears(years).Humanize());
+ DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future);
+ }
+
+ [Theory]
+ [InlineData(1, "ayer")]
+ [InlineData(2, "hace 2 días")]
+ public void DaysAgo(int days, string expected)
+ {
+ DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past);
+ }
+
+ [Theory]
+ [InlineData(1, "mañana")]
+ [InlineData(2, "en 2 días")]
+ public void DaysFromNow(int days, string expected)
+ {
+ DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future);
+ }
+
+ [Theory]
+ [InlineData(1, "hace un mes")]
+ [InlineData(2, "hace 2 meses")]
+ public void MonthsAgo(int months, string expected)
+ {
+ DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past);
+ }
+
+ [Theory]
+ [InlineData(1, "en un mes")]
+ [InlineData(2, "en 2 meses")]
+ public void MonthsFromNow(int months, string expected)
+ {
+ DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future);
+ }
+
+ [Theory]
+ [InlineData(1, "hace un año")]
+ [InlineData(2, "hace 2 años")]
+ public void YearsAgo(int years, string expected)
+ {
+ DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past);
+ }
+
+ [Theory]
+ [InlineData(1, "en un año")]
+ [InlineData(2, "en 2 años")]
+ public void YearsFromNow(int years, string expected)
+ {
+ DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future);
}
}
}
diff --git a/src/Humanizer.Tests/Localisation/es/TimeSpanHumanizeTests.cs b/src/Humanizer.Tests/Localisation/es/TimeSpanHumanizeTests.cs
index 171a61572..23ef08f7e 100644
--- a/src/Humanizer.Tests/Localisation/es/TimeSpanHumanizeTests.cs
+++ b/src/Humanizer.Tests/Localisation/es/TimeSpanHumanizeTests.cs
@@ -5,7 +5,7 @@ namespace Humanizer.Tests.Localisation.es
{
public class TimeSpanHumanizeTests : AmbientCulture
{
- public TimeSpanHumanizeTests() : base("es-ES") { }
+ public TimeSpanHumanizeTests() : base("es-ES") { }
[Fact]
public void TwoWeeks()
@@ -89,7 +89,7 @@ public void OneMillisecond()
public void NoTime()
{
// This one doesn't make a lot of sense but ... w/e
- Assert.Equal("no hay tiempo", TimeSpan.Zero.Humanize());
+ Assert.Equal("0 segundos", TimeSpan.Zero.Humanize());
}
}
}
\ No newline at end of file
diff --git a/src/Humanizer/Properties/Resources.es.resx b/src/Humanizer/Properties/Resources.es.resx
index 1eaaef69c..b738e9da1 100644
--- a/src/Humanizer/Properties/Resources.es.resx
+++ b/src/Humanizer/Properties/Resources.es.resx
@@ -190,6 +190,45 @@
una semana
- no hay tiempo
+ 0 segundos
+
+
+ en {0} días
+
+
+ en {0} horas
+
+
+ en {0} minutos
+
+
+ en {0} meses
+
+
+ en {0} segundos
+
+
+ en {0} años
+
+
+ mañana
+
+
+ en una hora
+
+
+ en un minuto
+
+
+ en un mes
+
+
+ en un segundo
+
+
+ en un año
+
+
+ ahora
\ No newline at end of file