@Test
public void testFormatYearsMonths() {
- assertFormat(366, DAY_IN_MILLIS, "1 year, 0 month ago");
+ assertFormat(366, DAY_IN_MILLIS, "1 year ago");
assertFormat(380, DAY_IN_MILLIS, "1 year, 1 month ago");
assertFormat(410, DAY_IN_MILLIS, "1 year, 2 months ago");
- assertFormat(2, YEAR_IN_MILLIS, "2 years, 0 month ago");
+ assertFormat(2, YEAR_IN_MILLIS, "2 years ago");
assertFormat(1824, DAY_IN_MILLIS, "4 years, 12 months ago");
}
years=years
yearsAgo={0} years ago
yearsMonthsAgo={0} {1}, {2} {3} ago
+years0MonthsAgo={0} {1} ago
treeWalkMustHaveExactlyTwoTrees=TreeWalk should have exactly two trees.
cannotBeRecursiveWhenTreesAreIncluded=TreeWalk shouldn't be recursive when tree objects are included.
/***/ public String year;
/***/ public String years;
/***/ public String yearsAgo;
+ /***/ public String years0MonthsAgo;
/***/ public String yearsMonthsAgo;
/***/ public String treeWalkMustHaveExactlyTwoTrees;
/***/ public String cannotBeRecursiveWhenTreesAreIncluded;
JGitText.get().year;
long months = round(ageMillis % YEAR_IN_MILLIS, MONTH_IN_MILLIS);
String monthLabel = (months > 1) ? JGitText.get().months : //
- JGitText.get().month;
- return MessageFormat.format(JGitText.get().yearsMonthsAgo,
+ (months == 1 ? JGitText.get().month : "");
+ return MessageFormat.format(
+ months == 0 ? JGitText.get().years0MonthsAgo : JGitText
+ .get().yearsMonthsAgo,
new Object[] { years, yearLabel, months, monthLabel });
}