Skip to content

Commit

Permalink
Merge branch 'alexitelman-master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	core/src/main/java/org/ocpsoft/prettytime/i18n/Resources_he.java
#	core/src/main/java/org/ocpsoft/prettytime/i18n/Resources_iw.java
  • Loading branch information
Alex Itelman committed Dec 1, 2015
2 parents 7090497 + dd3d607 commit 446c37a
Show file tree
Hide file tree
Showing 6 changed files with 517 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.ListResourceBundle;

public class Resources_he_IL extends ListResourceBundle {
public class Resources_he extends ListResourceBundle {
private static final Object[][] OBJECTS = new Object[][] {
{ "CenturyPattern", "%n %u" },
{ "CenturyFuturePrefix", "בעוד " },
Expand Down Expand Up @@ -44,8 +44,8 @@ public class Resources_he_IL extends ListResourceBundle {
{ "MillenniumFutureSuffix", "" },
{ "MillenniumPastPrefix", "לפני " },
{ "MillenniumPastSuffix", "" },
{ "MillenniumSingularName", "אלף שנים" },
{ "MillenniumPluralName", "אלפי שנים" },
{ "MillenniumSingularName", "מילניום" },
{ "MillenniumPluralName", "מילניומים" },
{ "MillisecondPattern", "%n %u" },
{ "MillisecondFuturePrefix", "בעוד " },
{ "MillisecondFutureSuffix", "" },
Expand Down Expand Up @@ -101,4 +101,4 @@ public Object[][] getContents()
{
return OBJECTS;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.ListResourceBundle;

public class Resources_iw_IL extends ListResourceBundle {
public class Resources_iw extends ListResourceBundle {
private static final Object[][] OBJECTS = new Object[][] {
{ "CenturyPattern", "%n %u" },
{ "CenturyFuturePrefix", "בעוד " },
Expand Down Expand Up @@ -44,8 +44,8 @@ public class Resources_iw_IL extends ListResourceBundle {
{ "MillenniumFutureSuffix", "" },
{ "MillenniumPastPrefix", "לפני " },
{ "MillenniumPastSuffix", "" },
{ "MillenniumSingularName", "אלף שנים" },
{ "MillenniumPluralName", "אלפי שנים" },
{ "MillenniumSingularName", "מילניום" },
{ "MillenniumPluralName", "מילניומים" },
{ "MillisecondPattern", "%n %u" },
{ "MillisecondFuturePrefix", "בעוד " },
{ "MillisecondFutureSuffix", "" },
Expand Down Expand Up @@ -101,4 +101,4 @@ public Object[][] getContents()
{
return OBJECTS;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,56 +76,56 @@ public void testRightNowVariance() throws Exception
public void testMinutesFromNow() throws Exception
{
PrettyTime t = new PrettyTime(new Date(0));
assertEquals("dintre de 12 minuts", t.format(new Date(1000 * 60 * 12)));
assertEquals("d'aquí a 12 minuts", t.format(new Date(1000 * 60 * 12)));
}

@Test
public void testHoursFromNow() throws Exception
{
PrettyTime t = new PrettyTime(new Date(0));
assertEquals("dintre de 3 hores", t.format(new Date(1000 * 60 * 60 * 3)));
assertEquals("d'aquí a 3 hores", t.format(new Date(1000 * 60 * 60 * 3)));
}

@Test
public void testDaysFromNow() throws Exception
{
PrettyTime t = new PrettyTime(new Date(0));
assertEquals("dintre de 3 dies", t.format(new Date(1000 * 60 * 60 * 24 * 3)));
assertEquals("d'aquí a 3 dies", t.format(new Date(1000 * 60 * 60 * 24 * 3)));
}

@Test
public void testWeeksFromNow() throws Exception
{
PrettyTime t = new PrettyTime(new Date(0));
assertEquals("dintre de 3 setmanes", t.format(new Date(1000 * 60 * 60 * 24 * 7 * 3)));
assertEquals("d'aquí a 3 setmanes", t.format(new Date(1000 * 60 * 60 * 24 * 7 * 3)));
}

@Test
public void testMonthsFromNow() throws Exception
{
PrettyTime t = new PrettyTime(new Date(0));
assertEquals("dintre de 3 mesos", t.format(new Date(2629743830L * 3L)));
assertEquals("d'aquí a 3 mesos", t.format(new Date(2629743830L * 3L)));
}

@Test
public void testYearsFromNow() throws Exception
{
PrettyTime t = new PrettyTime(new Date(0));
assertEquals("dintre de 3 anys", t.format(new Date(2629743830L * 12L * 3L)));
assertEquals("d'aquí a 3 anys", t.format(new Date(2629743830L * 12L * 3L)));
}

@Test
public void testDecadesFromNow() throws Exception
{
PrettyTime t = new PrettyTime(new Date(0));
assertEquals("dintre de 3 desenis", t.format(new Date(315569259747L * 3L)));
assertEquals("d'aquí a 3 desenis", t.format(new Date(315569259747L * 3L)));
}

@Test
public void testCenturiesFromNow() throws Exception
{
PrettyTime t = new PrettyTime(new Date(0));
assertEquals("dintre de 3 segles", t.format(new Date(3155692597470L * 3L)));
assertEquals("d'aquí a 3 segles", t.format(new Date(3155692597470L * 3L)));
}

/*
Expand Down Expand Up @@ -190,7 +190,7 @@ public long getMillisPerUnit()
{
return 5000;
}

@Override
public boolean isPrecise()
{
Expand All @@ -199,11 +199,11 @@ public boolean isPrecise()
};
t.clearUnits();
t.registerUnit(unit, new SimpleTimeFormat()
.setSingularName("tick").setPluralName("ticks")
.setPattern("%n %u").setRoundingTolerance(20)
.setFutureSuffix("... RUN!")
.setFuturePrefix("self destruct in: ").setPastPrefix("self destruct was: ").setPastSuffix(
" ago..."));
.setSingularName("tick").setPluralName("ticks")
.setPattern("%n %u").setRoundingTolerance(20)
.setFutureSuffix("... RUN!")
.setFuturePrefix("self destruct in: ").setPastPrefix("self destruct was: ").setPastSuffix(
" ago..."));

assertEquals("self destruct in: 5 ticks ... RUN!", t.format(new Date(25000)));
t.setReference(new Date(25000));
Expand Down Expand Up @@ -243,7 +243,7 @@ public void testPreciseInTheFuture() throws Exception
{
PrettyTime t = new PrettyTime();
List<Duration> durations = t.calculatePreciseDuration(new Date(new Date().getTime() + 1000
* (10 * 60 + 5 * 60 * 60)));
* (10 * 60 + 5 * 60 * 60)));
assertTrue(durations.size() >= 2); // might be more because of milliseconds between date capturing and result
// calculation
assertEquals(5, durations.get(0).getQuantity());
Expand All @@ -255,7 +255,7 @@ public void testPreciseInThePast() throws Exception
{
PrettyTime t = new PrettyTime();
List<Duration> durations = t.calculatePreciseDuration(new Date(new Date().getTime() - 1000
* (10 * 60 + 5 * 60 * 60)));
* (10 * 60 + 5 * 60 * 60)));
assertTrue(durations.size() >= 2); // might be more because of milliseconds between date capturing and result
// calculation
assertEquals(-5, durations.get(0).getQuantity());
Expand All @@ -275,8 +275,8 @@ public void testFormattingDurationListInTheFuture() throws Exception
{
PrettyTime t = new PrettyTime(new Date(0));
List<Duration> durations = t.calculatePreciseDuration(new Date(1000 * 60 * 60 * 24 * 3 + 1000 * 60 * 60 * 15
+ 1000 * 60 * 38));
assertEquals("dintre de 3 dies 15 hores 38 minuts", t.format(durations));
+ 1000 * 60 * 38));
assertEquals("d'aquí a 3 dies 15 hores 38 minuts", t.format(durations));
}

@Test
Expand Down
Loading

0 comments on commit 446c37a

Please sign in to comment.