Fix string detection issues and complete pt-BR localization (100% done, as far as I can tell)

This commit is contained in:
Felipe Giacomini Cocco 2026-02-05 22:55:25 -03:00
commit f6f6321def
14 changed files with 402 additions and 77 deletions

View file

@ -81,7 +81,7 @@ class BatteryStatusViewModel: ObservableObject {
print("🔌 Power source: \(isPluggedIn ? "Connected" : "Disconnected")")
withAnimation {
self.isPluggedIn = isPluggedIn
self.statusText = isPluggedIn ? "Plugged In" : "Unplugged"
self.statusText = isPluggedIn ? String(localized: "Plugged In") : String(localized: "Unplugged")
self.notifyImportanChangeStatus()
}
@ -98,7 +98,7 @@ class BatteryStatusViewModel: ObservableObject {
self.notifyImportanChangeStatus()
withAnimation {
self.isInLowPowerMode = isEnabled
self.statusText = "Low Power: \(self.isInLowPowerMode ? "On" : "Off")"
self.statusText = String(localized: "Low Power: \(self.isInLowPowerMode ? String(localized: "On") : String(localized: "Off"))")
}
case .isChargingChanged(let isCharging):
@ -110,8 +110,8 @@ class BatteryStatusViewModel: ObservableObject {
self.isCharging = isCharging
self.statusText =
isCharging
? "Charging battery"
: (self.levelBattery < self.maxCapacity ? "Not charging" : "Full charge")
? String(localized: "Charging battery")
: (self.levelBattery < self.maxCapacity ? String(localized: "Not charging") : String(localized: "Full charge"))
}
case .timeToFullChargeChanged(let time):
@ -141,7 +141,7 @@ class BatteryStatusViewModel: ObservableObject {
self.isInLowPowerMode = batteryInfo.isInLowPowerMode
self.timeToFullCharge = batteryInfo.timeToFullCharge
self.maxCapacity = batteryInfo.maxCapacity
self.statusText = batteryInfo.isPluggedIn ? "Plugged In" : "Unplugged"
self.statusText = batteryInfo.isPluggedIn ? String(localized: "Plugged In") : String(localized: "Unplugged")
}
}
@ -161,7 +161,7 @@ class BatteryStatusViewModel: ObservableObject {
for threshold in lowBatteryAlertThresholds {
if previousLevel >= threshold && newLevel < threshold {
self.statusText = "Low battery"
self.statusText = String(localized: "Low battery")
notifyImportanChangeStatus()
playLowBatteryAlertSound()
break

View file

@ -284,15 +284,15 @@ enum ScreenAssistantDisplayMode: String, CaseIterable, Codable, Defaults.Seriali
var displayName: String {
switch self {
case .popover: return "Popover"
case .panel: return "Panel"
case .popover: return String(localized: "Popover")
case .panel: return String(localized: "Panel")
}
}
var description: String {
switch self {
case .popover: return "Shows screen assistant as a dropdown attached to the AI button"
case .panel: return "Shows screen assistant in a floating panel near the notch"
case .popover: return String(localized: "Shows screen assistant as a dropdown attached to the AI button")
case .panel: return String(localized: "Shows screen assistant in a floating panel near the notch")
}
}
}
@ -335,6 +335,15 @@ enum MediaControllerType: String, CaseIterable, Identifiable, Defaults.Serializa
case youtubeMusic = "Youtube Music"
var id: String { self.rawValue }
var localizedName: String {
switch self {
case .nowPlaying: return String(localized: "Now Playing")
case .appleMusic: return String(localized: "Apple Music")
case .spotify: return String(localized: "Spotify")
case .youtubeMusic: return String(localized: "Youtube Music")
}
}
}
// Sneak peek styles for selection in settings