Polish (pl), Russian (ru), Ukrainian (uk), and Kazakh (kk) do not provide time units when formatting a duration.
@Test fun testPL() = testPrettyTimeFails(Locale("pl"))
@Test fun testRU() = testPrettyTimeFails(Locale("ru"))
@Test fun testUK() = testPrettyTimeFails(Locale("uk"))
@Test fun testKK() = testPrettyTimeFails(Locale("kk"))
private fun testPrettyTimeFails(locale: Locale) {
val date = Date.from(Instant.now().minus(Duration.ofDays(1)))
val durationString = PrettyTime(locale).formatDuration(date)
assertNotEquals("1", durationString)
}
This is because these four languages override TimeFormat::format with an implementation similar to this:
@Override
public String format(Duration duration)
{
long quantity = duration.getQuantityRounded(tolerance);
return String.valueOf(quantity);
}
@lbenedetto Hey, thanks for reporting - and @Snow4DV thanks for fixing (for Russian). Hoping you can also work on the others! I am unfortunately not familiar with these languages!
Polish (pl), Russian (ru), Ukrainian (uk), and Kazakh (kk) do not provide time units when formatting a duration.
This is because these four languages override
TimeFormat::format
with an implementation similar to this: