@@ -40,28 +40,28 @@ final class BatteryService {
4040 }
4141 if charging {
4242 return . charging( percentage: percentage)
43- } else {
44- return . discharging( percentage: percentage)
4543 }
44+
45+ return . discharging( percentage: percentage)
4646 }
4747
4848 /// The remaining time until the battery is empty or fully charged
4949 /// in a human readable format, e.g. hh:mm.
5050 var timeRemainingFormatted : String {
5151 // Unwrap required information.
5252 guard let charged = isCharged, let plugged = isPlugged else {
53- return NSLocalizedString ( " Unknown " , comment: " Translate Unknown " )
53+ return NSLocalizedString ( " Unknown " , comment: " " )
5454 }
5555 // Check if the battery is charged and plugged into an unlimited power supply.
5656 if charged && plugged {
57- return NSLocalizedString ( " Charged " , comment: " Translate Charged " )
57+ return NSLocalizedString ( " Charged " , comment: " " )
5858 }
5959 // The battery is (dis)charging, display the remaining time.
6060 if let time = timeRemaining {
6161 return String ( format: " %d:%02d " , arguments: [ time / 60 , time % 60 ] )
62- } else {
63- return NSLocalizedString ( " Calculating " , comment: " Translate Calculating " )
6462 }
63+
64+ return NSLocalizedString ( " Calculating " , comment: " " )
6565 }
6666
6767 /// The remaining time in _minutes_ until the battery is empty or fully charged.
@@ -80,7 +80,7 @@ final class BatteryService {
8080 }
8181 return nil
8282 default :
83- // Return the estimated time divided by 60 (seconds to minutes).
83+ // The estimated time in minutes
8484 return Int ( time / 60 )
8585 }
8686 }
@@ -103,14 +103,14 @@ final class BatteryService {
103103 /// The source from which the Mac currently draws its power.
104104 var powerSource : String {
105105 guard let plugged = isPlugged else {
106- return NSLocalizedString ( " Unknown " , comment: " Translate Unknown " )
106+ return NSLocalizedString ( " Unknown " , comment: " " )
107107 }
108108 // Check whether the MacBook currently is plugged into a power adapter.
109109 if plugged {
110- return NSLocalizedString ( " Power Adapter " , comment: " Translate Power Adapter " )
111- } else {
112- return NSLocalizedString ( " Battery " , comment: " Translate Battery " )
110+ return NSLocalizedString ( " Power Adapter " , comment: " " )
113111 }
112+
113+ return NSLocalizedString ( " Battery " , comment: " " )
114114 }
115115
116116 /// Checks whether the battery is charging and connected to a power outlet.
@@ -135,7 +135,7 @@ final class BatteryService {
135135 let amperage = getRegistryProperty ( forKey: . amperage) as? Double else {
136136 return nil
137137 }
138- return round ( ( ( voltage * amperage) / 1_000_000 ) * 10 ) / 10
138+ return round ( ( voltage * amperage) / 1_000_000 )
139139 }
140140
141141 /// Current flowing into or out of the battery.
0 commit comments