فهرست منبع

Replace commas with periods in speech output

Jonas Björkert 2 سال پیش
والد
کامیت
82d0353705
1فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 4 4
      LoopFollow/Controllers/Alarms.swift

+ 4 - 4
LoopFollow/Controllers/Alarms.swift

@@ -1007,21 +1007,21 @@ extension MainViewController {
         let texts = AnnouncementTexts.forLanguage(preferredLanguage)
         let texts = AnnouncementTexts.forLanguage(preferredLanguage)
         
         
         let negligibleThreshold = 3
         let negligibleThreshold = 3
-        let absoluteDifference = bgUnits.toDisplayUnits(String(abs(bloodGlucoseDifference)))
+        let localizedCurrentValue = bgUnits.toDisplayUnits(String(currentValue)).replacingOccurrences(of: ",", with: ".")
         let announcementText: String
         let announcementText: String
         
         
         if abs(bloodGlucoseDifference) <= negligibleThreshold {
         if abs(bloodGlucoseDifference) <= negligibleThreshold {
-            announcementText = "\(texts.currentBGIs) \(bgUnits.toDisplayUnits(String(currentValue))) \(texts.stable)"
+            announcementText = "\(texts.currentBGIs) \(localizedCurrentValue) \(texts.stable)"
         } else {
         } else {
             let directionText = bloodGlucoseDifference < 0 ? texts.decrease : texts.increase
             let directionText = bloodGlucoseDifference < 0 ? texts.decrease : texts.increase
-            announcementText = "\(texts.currentBGIs) \(bgUnits.toDisplayUnits(String(currentValue))) \(directionText) \(absoluteDifference)"
+            let absoluteDifference = bgUnits.toDisplayUnits(String(abs(bloodGlucoseDifference))).replacingOccurrences(of: ",", with: ".")
+            announcementText = "\(texts.currentBGIs) \(localizedCurrentValue) \(directionText) \(absoluteDifference)"
         }
         }
         
         
         let speechUtterance = AVSpeechUtterance(string: announcementText)
         let speechUtterance = AVSpeechUtterance(string: announcementText)
         speechUtterance.voice = AVSpeechSynthesisVoice(language: voiceLanguageCode)
         speechUtterance.voice = AVSpeechSynthesisVoice(language: voiceLanguageCode)
         
         
         speechSynthesizer.speak(speechUtterance)
         speechSynthesizer.speak(speechUtterance)
-
     }
     }
     
     
     func isOnPhoneCall() -> Bool {
     func isOnPhoneCall() -> Bool {