LocationItem: localize departure time preview (#1294)

* localize departure time preview

* use plurals

* use plural format string correctly
This commit is contained in:
Christoph
2025-03-23 20:39:42 +01:00
committed by GitHub
parent daa601e9fc
commit 162ee870b9
3 changed files with 15 additions and 2 deletions
@@ -453,8 +453,11 @@ fun LocationItem(
java.time.LocalTime.now(),
nextDeparture.time + (nextDeparture.delay
?: Duration.ZERO)
).toMinutes()
if (timeLeft < 1) "now" else "in $timeLeft min"
).toMinutes().toInt()
if (timeLeft < 1)
context.getString(R.string.departure_time_now)
else
context.resources.getQuantityString(R.plurals.departure_time_in, timeLeft, timeLeft)
}
Text(