LoopKit / Loop

An automated insulin delivery app for iOS, built on LoopKit
https://loopdocs.org
Other
1.51k stars 1.3k forks source link

Bolus screen after edit carbs give warning message with BG value in wrong units (when using mmol/L) #1392

Closed bjornoleh closed 1 year ago

bjornoleh commented 4 years ago

The bolus screen after editing of a meal entry give BG in wrong units in this warning message: Predicted glucose of xx [BG-units] is below your suspend threshold setting

This is only tested when using mmol/L units, but repeated on two different phones, one with English and another with Norwegian language.

The bolus screen after a new carb entry is displayed as it should, with mmol/L units for both the eventual BG and in the warning message: image

The bolus screen after editing a carb entry is different. Here, the eventual BG is in mmol/L, and the warning is in mg/dL: image

To Reproduce Steps to reproduce the behavior. Requirement: Part of the prediction curve must be below the suspend treshold. Tested only with units set as mmol/L.

  1. Go to the list of meals, click one and make a change.
  2. Click on continue to enter the bolus screen
  3. Observe the warning message displaying BG as mg/dL

Expected behavior Would expect mmol/L units in all cases. This is the result if the bolus screen is entered from a new carb entry.

Affected versions (confirmed): Loop master 2.2.1 (english language) FreeAPS 172 and older (Norwegian language)

Phone Phone with FreeAPS: Old iPhone SE iOS 13.7

CGM Dexcom G6 G6 app

Pump Omnipod

Other context This was first discussed here, under the assumption that it was related to translations. It has since then become clear it's not: https://loop.zulipchat.com/#narrow/stream/144182-development/topic/Norwegian.20translations/near/209873573

But it is related to these two localized strings (based on searching the Loop translation project in Crowdin):

Predicted glucose of %1$@ is below your suspend threshold setting.

DoseMathTests/Base.lproj/Localizable.strings Predicted glucose of %1$@ is below your suspend threshold setting. Notice message when recommending bolus when BG is below the suspend threshold. (1: glucose value)

Predicted glucose of %1$@ is below your suspend threshold setting.

Loop/Base.lproj/Localizable.strings Predicted glucose of %1$@ is below your suspend threshold setting. Notice message when recommending bolus when BG is below the suspend threshold. (1: glucose value)

bjornoleh commented 2 years ago

If anyone would like to take a stab at fixing this, here is some supplemental info.

To find out if there were different localizations used for the two results (from bolus screen or edit carbs screen), I edited the localization strings and changed them a bit (Adding -Loop to one, since this file is in Loop/Loop, and -dosemathtest to the other). The result show that in both cases it is the same string in Loop that is being used. DoseMathTest is not used at all (could be deleted altogether without affecting the ability to build Loop).

image

bjornoleh commented 2 years ago

The source string is found in

LoopWorkspace/Loop/Loop/Models/BolusRecommendation.swift

return String(format: NSLocalizedString("Predicted glucose of %1$@ is below your suspend threshold setting.", comment: "Notice message when recommending bolus when BG is below the suspend threshold. (1: glucose value)"), bgStr)

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

bjornoleh commented 1 year ago

This is probably only related to Loop 2.x, and as such obsolete by now. Closing this issue.