From d23faf65bff66fb5775a5d030d3d7258f1185340 Mon Sep 17 00:00:00 2001 From: Philoul Date: Wed, 6 Nov 2019 20:31:05 +0100 Subject: [PATCH 1/2] Add strings for shortday (shorthour allready exists) for translation of statuslights and remaining time TT in main screen --- .../java/info/nightscout/androidaps/db/CareportalEvent.java | 4 ++-- .../main/java/info/nightscout/androidaps/utils/DateUtil.java | 2 +- app/src/main/res/values/strings.xml | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/db/CareportalEvent.java b/app/src/main/java/info/nightscout/androidaps/db/CareportalEvent.java index 40fadff684..1c33e8f1be 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/CareportalEvent.java +++ b/app/src/main/java/info/nightscout/androidaps/db/CareportalEvent.java @@ -100,8 +100,8 @@ public class CareportalEvent implements DataPointWithLabelInterface, Interval { String hours = " " + MainApp.gs(R.string.hours) + " "; if (useShortText) { - days = "d"; - hours = "h"; + days = MainApp.gs(R.string.shortday); + hours = MainApp.gs(R.string.shorthour); } return diff.get(TimeUnit.DAYS) + days + diff.get(TimeUnit.HOURS) + hours; diff --git a/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java b/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java index d592347d1b..8b3996a3dc 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java +++ b/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java @@ -185,7 +185,7 @@ public class DateUtil { long remainingTimeMinutes = timeInMillis / (1000 * 60); long remainingTimeHours = remainingTimeMinutes / 60; remainingTimeMinutes = remainingTimeMinutes % 60; - return "(" + ((remainingTimeHours > 0) ? (remainingTimeHours + "h ") : "") + remainingTimeMinutes + "')"; + return "(" + ((remainingTimeHours > 0) ? (remainingTimeHours + MainApp.gs(R.string.shorthour) + " ") : "") + remainingTimeMinutes + "')"; } public static String sinceString(long timestamp) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 70e05db6c4..3942e9c030 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -778,6 +778,7 @@ g m h + d ]]> kJ En From fa765708f1f6f3ea7891101af1ab06dc642b4f9a Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 22 Nov 2019 16:10:27 +0100 Subject: [PATCH 2/2] fix test --- app/src/test/java/info/AAPSMocker.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/test/java/info/AAPSMocker.java b/app/src/test/java/info/AAPSMocker.java index a36c989b11..ed9f2c82a2 100644 --- a/app/src/test/java/info/AAPSMocker.java +++ b/app/src/test/java/info/AAPSMocker.java @@ -107,6 +107,8 @@ public class AAPSMocker { when(MainApp.gs(R.string.configbuilder_insulin)).thenReturn("Insulin"); when(MainApp.gs(R.string.bolusdelivering)).thenReturn("Delivering 0.0U"); when(MainApp.gs(R.string.profile_per_unit)).thenReturn("/U"); + when(MainApp.gs(R.string.shortday)).thenReturn("d"); + when(MainApp.gs(R.string.shorthour)).thenReturn("h"); when(MainApp.gs(R.string.profile_carbs_per_unit)).thenReturn("g/U"); when(MainApp.gs(R.string.profile_ins_units_per_hour)).thenReturn("U/h"); when(MainApp.gs(R.string.sms_wrongcode)).thenReturn("Wrong code. Command cancelled.");