Merge pull request #965 from Philoul/Nex/AddMoreStrings

Add strings for Command Queue translation
This commit is contained in:
Milos Kozak 2021-11-23 23:21:19 +01:00 committed by GitHub
commit 6c990a4423
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 48 additions and 18 deletions

View file

@ -32,7 +32,7 @@ class CommandBolus(
} }
override fun status(): String { override fun status(): String {
return (if (detailedBolusInfo.insulin > 0) "BOLUS " + rh.gs(R.string.formatinsulinunits, detailedBolusInfo.insulin) else "") + return (if (detailedBolusInfo.insulin > 0) rh.gs(R.string.bolus_u_min, detailedBolusInfo.insulin) else "") +
if (detailedBolusInfo.carbs > 0) "CARBS " + rh.gs(R.string.format_carbs, detailedBolusInfo.carbs.toInt()) else "" if (detailedBolusInfo.carbs > 0) rh.gs(R.string.carbs_g, detailedBolusInfo.carbs.toInt()) else ""
} }
} }

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.queue.commands package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
@ -19,5 +20,5 @@ class CommandCancelExtendedBolus constructor(
callback?.result(r)?.run() callback?.result(r)?.run()
} }
override fun status(): String = "CANCEL EXTENDEDBOLUS" override fun status(): String = rh.gs(R.string.uel_cancel_extended_bolus)
} }

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.queue.commands package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
@ -20,5 +21,5 @@ class CommandCancelTempBasal(
callback?.result(r)?.run() callback?.result(r)?.run()
} }
override fun status(): String = "CANCEL TEMPBASAL" override fun status(): String = rh.gs(R.string.uel_accepts_temp_basal)
} }

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.queue.commands package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
@ -21,5 +22,5 @@ class CommandExtendedBolus constructor(
callback?.result(r)?.run() callback?.result(r)?.run()
} }
override fun status(): String = "EXTENDEDBOLUS $insulin U $durationInMinutes min" override fun status(): String = rh.gs(R.string.extended_bolus_u_min, insulin, durationInMinutes)
} }

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.queue.commands package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
@ -23,5 +24,5 @@ class CommandInsightSetTBROverNotification constructor(
} }
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
override fun status(): String = "INSIGHTSETTBROVERNOTIFICATION" override fun status(): String = rh.gs(R.string.insight_set_tbr_over_notification)
} }

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.queue.commands package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Dana import info.nightscout.androidaps.interfaces.Dana
import info.nightscout.androidaps.interfaces.Diaconn import info.nightscout.androidaps.interfaces.Diaconn
@ -32,5 +33,5 @@ class CommandLoadEvents(
} }
} }
override fun status(): String = "LOAD EVENTS" override fun status(): String = rh.gs(R.string.load_events)
} }

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.queue.commands package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Dana import info.nightscout.androidaps.interfaces.Dana
import info.nightscout.androidaps.interfaces.Diaconn import info.nightscout.androidaps.interfaces.Diaconn
@ -33,5 +34,5 @@ class CommandLoadHistory(
} }
} }
override fun status(): String = "LOAD HISTORY $type" override fun status(): String = rh.gs(R.string.load_history, type.toInt())
} }

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.queue.commands package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
@ -20,5 +21,5 @@ class CommandLoadTDDs(
callback?.result(r)?.run() callback?.result(r)?.run()
} }
override fun status(): String = "LOAD TDDs" override fun status(): String = rh.gs(R.string.load_tdds)
} }

View file

@ -37,5 +37,5 @@ class CommandSMBBolus(
callback?.result(r)?.run() callback?.result(r)?.run()
} }
override fun status(): String = "SMB BOLUS ${rh.gs(R.string.formatinsulinunits, detailedBolusInfo.insulin)}" override fun status(): String = rh.gs(R.string.smb_bolus_u, detailedBolusInfo.insulin)
} }

View file

@ -45,5 +45,5 @@ class CommandSetProfile constructor(
} }
} }
override fun status(): String = "SET PROFILE" override fun status(): String = rh.gs(R.string.set_profile)
} }

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.queue.commands package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Dana import info.nightscout.androidaps.interfaces.Dana
import info.nightscout.androidaps.interfaces.Diaconn import info.nightscout.androidaps.interfaces.Diaconn
@ -30,5 +31,5 @@ class CommandSetUserSettings(
} }
} }
override fun status(): String = "SET USER SETTINGS" override fun status(): String = rh.gs(R.string.set_user_settings)
} }

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.queue.commands package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
@ -21,5 +22,5 @@ class CommandStartPump(
} }
} }
override fun status(): String = "START PUMP" override fun status(): String = rh.gs(R.string.start_pump)
} }

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.queue.commands package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
@ -21,5 +22,5 @@ class CommandStopPump(
} }
} }
override fun status(): String = "STOP PUMP" override fun status(): String = rh.gs(R.string.stop_pump)
} }

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.queue.commands package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.PumpSync
@ -26,5 +27,5 @@ class CommandTempBasalAbsolute(
callback?.result(r)?.run() callback?.result(r)?.run()
} }
override fun status(): String = "TEMP BASAL $absoluteRate U/h $durationInMinutes min" override fun status(): String = rh.gs(R.string.temp_basal_absolute, absoluteRate, durationInMinutes)
} }

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.queue.commands package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.PumpSync
@ -30,5 +31,5 @@ class CommandTempBasalPercent(
callback?.result(r)?.run() callback?.result(r)?.run()
} }
override fun status(): String = "TEMP BASAL $percent% $durationInMinutes min" override fun status(): String = rh.gs(R.string.temp_basal_percent, percent, durationInMinutes)
} }

View file

@ -4,6 +4,7 @@ import android.content.Context
import android.os.PowerManager import android.os.PowerManager
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.TestPumpPlugin import info.nightscout.androidaps.TestPumpPlugin
import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.AppRepository
@ -21,6 +22,7 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.mockito.ArgumentMatchers
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito import org.mockito.Mockito
@ -41,6 +43,7 @@ class QueueThreadTest : TestBaseWithProfile() {
} }
if (it is CommandTempBasalAbsolute) { if (it is CommandTempBasalAbsolute) {
it.activePlugin = activePlugin it.activePlugin = activePlugin
it.rh = rh
} }
} }
} }
@ -75,6 +78,7 @@ class QueueThreadTest : TestBaseWithProfile() {
val percentageConstraint = Constraint(0) val percentageConstraint = Constraint(0)
Mockito.`when`(constraintChecker.applyBasalPercentConstraints(anyObject(), anyObject())) Mockito.`when`(constraintChecker.applyBasalPercentConstraints(anyObject(), anyObject()))
.thenReturn(percentageConstraint) .thenReturn(percentageConstraint)
Mockito.`when`(rh.gs(ArgumentMatchers.eq(R.string.temp_basal_absolute), anyObject(), anyObject())).thenReturn("TEMP BASAL %1\$.2f U/h %2\$d min")
sut = QueueThread(commandQueue, context, aapsLogger, rxBus, activePlugin, rh, sp) sut = QueueThread(commandQueue, context, aapsLogger, rxBus, activePlugin, rh, sp)
} }

View file

@ -504,7 +504,22 @@
<string name="basal_value">Basal value</string> <string name="basal_value">Basal value</string>
<string name="nsclient_version_does_not_match">NSClient version doesn\'t match to AndroidAPS. Please update.</string> <string name="nsclient_version_does_not_match">NSClient version doesn\'t match to AndroidAPS. Please update.</string>
<!-- readStatus reasons --> <!-- Command Queue + readStatus reasons -->
<string name="bolus_u_min">BOLUS %1$.2f U</string>
<string name="carbs_g">CARBS %1$d g</string>
<string name="extended_bolus_u_min">EXTENDED BOLUS %1$.2f U %2$d min</string>
<string name="load_events">LOAD EVENTS</string>
<string name="load_history">LOAD HISTORY %1$d</string>
<string name="load_tdds">LOAD TDDs</string>
<string name="set_profile">SET PROFILE</string>
<string name="set_user_settings">SET USER SETTINGS</string>
<string name="smb_bolus_u">SMB BOLUS %1$.2f U</string>
<string name="start_pump">START PUMP</string>
<string name="stop_pump">STOP PUMP</string>
<string name="temp_basal_absolute">TEMP BASAL %1$.2f U/h %2$d min</string>
<string name="temp_basal_percent">TEMP BASAL %1$d%% %2$d min</string>
<string name="insight_set_tbr_over_notification">INSIGHT SET TBR OVER NOTIFICATION</string>
<string name="read_status" comment="10 characters max for READSTATUS translation">READSTATUS %1$s</string>
<string name="keepalive_status_outdated" comment="26 characters max for translation">KeepAlive. Status outdated.</string> <string name="keepalive_status_outdated" comment="26 characters max for translation">KeepAlive. Status outdated.</string>
<string name="keepalive_basal_outdated" comment="26 characters max for translation">KeepAlive. Basal outdated.</string> <string name="keepalive_basal_outdated" comment="26 characters max for translation">KeepAlive. Basal outdated.</string>
<string name="sms" comment="26 characters max for translation">SMS</string> <string name="sms" comment="26 characters max for translation">SMS</string>
@ -520,7 +535,6 @@
<string name="bolus_ok" comment="26 characters max for translation">Bolus OK</string> <string name="bolus_ok" comment="26 characters max for translation">Bolus OK</string>
<string name="pump_paired" comment="26 characters max for translation">Pump paired</string> <string name="pump_paired" comment="26 characters max for translation">Pump paired</string>
<string name="insight_refresh_button" comment="26 characters max for translation">Insight Refresh Button</string> <string name="insight_refresh_button" comment="26 characters max for translation">Insight Refresh Button</string>
<string name="read_status" comment="10 characters max for READSTATUS translation">READSTATUS %1$s</string>
<plurals name="days"> <plurals name="days">
<item quantity="one">%1$d day</item> <item quantity="one">%1$d day</item>