more translation

This commit is contained in:
Andrei Vereha 2021-09-21 20:34:27 +02:00
parent 613e7963f2
commit 6b441b515e

View file

@ -30,6 +30,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.R
import info.nightscout.androidaps.plugins.pump.omnipod.dash.databinding.OmnipodDashOverviewBinding import info.nightscout.androidaps.plugins.pump.omnipod.dash.databinding.OmnipodDashOverviewBinding
import info.nightscout.androidaps.plugins.pump.omnipod.dash.databinding.OmnipodDashOverviewBluetoothStatusBinding import info.nightscout.androidaps.plugins.pump.omnipod.dash.databinding.OmnipodDashOverviewBluetoothStatusBinding
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.ActivationProgress import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.ActivationProgress
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertType
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.queue.events.EventQueueChanged import info.nightscout.androidaps.queue.events.EventQueueChanged
@ -389,7 +390,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
} }
podInfoBinding.podActiveAlerts.text = podStateManager.activeAlerts?.let { it -> podInfoBinding.podActiveAlerts.text = podStateManager.activeAlerts?.let { it ->
it.joinToString(",") { it.toString() } it.joinToString(System.lineSeparator()) { t -> translatedActiveAlert(t) }
} ?: PLACEHOLDER } ?: PLACEHOLDER
} }
@ -402,6 +403,24 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
} }
} }
private fun translatedActiveAlert(alert: AlertType): String {
val id = when (alert) {
AlertType.LOW_RESERVOIR ->
R.string.omnipod_common_alert_low_reservoir
AlertType.EXPIRATION ->
R.string.omnipod_common_alert_expiration_advisory
AlertType.EXPIRATION_IMMINENT ->
R.string.omnipod_common_alert_expiration
AlertType.USER_SET_EXPIRATION ->
R.string.omnipod_common_alert_expiration_advisory
AlertType.AUTO_OFF ->
R.string.omnipod_common_alert_shutdown_imminent
else ->
R.string.omnipod_common_alert_unknown_alert
}
return resourceHelper.gs(id)
}
private fun updateLastConnection() { private fun updateLastConnection() {
if (podStateManager.isUniqueIdSet) { if (podStateManager.isUniqueIdSet) {
podInfoBinding.lastConnection.text = readableDuration( podInfoBinding.lastConnection.text = readableDuration(