Localize both pax counter and power config

This commit is contained in:
Garth Vander Houwen 2024-02-25 12:51:34 -08:00
parent 9ee3df519c
commit a42f9ed91a
5 changed files with 53 additions and 50 deletions

View file

@ -681,10 +681,10 @@
DD2160AE28C5552500C17253 /* MQTTConfig.swift */,
DD41582928585C32009B0E59 /* RangeTestConfig.swift */,
DDC94FCD29CF55310082EA6E /* RtttlConfig.swift */,
DD15E4F22B8BA56E00654F61 /* PaxCounterConfig.swift */,
DD6193782863875F00E59241 /* SerialConfig.swift */,
DDF6B2472A9AEBF500BA6931 /* StoreForwardConfig.swift */,
DD415827285859C4009B0E59 /* TelemetryConfig.swift */,
DD15E4F22B8BA56E00654F61 /* PaxCounterConfig.swift */,
);
path = Module;
sourceTree = "<group>";

View file

@ -20,7 +20,7 @@ struct PaxCounterConfig: View {
var body: some View {
Form {
ConfigHeader(title: "paxcounter", config: \.powerConfig, node: node, onAppear: setPaxValues)
ConfigHeader(title: "config.module.paxcounter.title", config: \.powerConfig, node: node, onAppear: setPaxValues)
Section {
Toggle(isOn: $enabled) {

View file

@ -25,22 +25,22 @@ struct PowerConfig: View {
var body: some View {
Form {
ConfigHeader(title: "Power", config: \.powerConfig, node: node, onAppear: setPowerValues)
ConfigHeader(title: "config.power.title", config: \.powerConfig, node: node, onAppear: setPowerValues)
Section {
if (currentDevice?.architecture == .esp32 || currentDevice?.architecture == .esp32S3) || (currentDevice?.architecture == .nrf52840 && (node?.deviceConfig?.role ?? 0 == 5 || node?.deviceConfig?.role ?? 0 == 6)) {
Toggle(isOn: $isPowerSaving) {
Label("Power Saving", systemImage: "bolt")
Text("Will sleep everything as much as possible, for the tracker and sensor role this will also include the lora radio. Don't use this setting if you want to use your device with the phone apps or are using a device without a user button.")
Label("config.power.saving", systemImage: "bolt")
Text("config.power.saving.description")
}
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
}
Toggle(isOn: $shutdownOnPowerLoss) {
Label("power.shutdown.on.power.loss", systemImage: "power")
Label("config.power.shutdown.on.power.loss", systemImage: "power")
}
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
if shutdownOnPowerLoss {
Picker("power.shutdown.after.secs", selection: $shutdownAfterSecs) {
Picker("config.power.shutdown.after.secs", selection: $shutdownAfterSecs) {
ForEach(PowerIntervals.allCases) { at in
Text(at.description)
}
@ -48,20 +48,20 @@ struct PowerConfig: View {
.pickerStyle(DefaultPickerStyle())
}
} header: {
Text("power")
Text("config.power.settings")
}
if currentDevice?.architecture == .esp32 || currentDevice?.architecture == .esp32S3 {
Section {
Toggle(isOn: $adcOverride) {
Text("power.adc.override")
Text("config.power.adc.override")
}
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
if adcOverride {
HStack {
Text("power.adc.multiplier")
Text("config.power.adc.multiplier")
Spacer()
FloatField(title: "power.adc.multiplier", number: $adcMultiplier) {
FloatField(title: "config.power.adc.multiplier", number: $adcMultiplier) {
(2.0 ... 6.0).contains($0)
}
.focused($isFocused)
@ -69,37 +69,37 @@ struct PowerConfig: View {
}
}
} header: {
Text("Battery")
Text("config.power.section.battery")
}
Section {
Picker("config.power.wait.bluetooth.secs", selection: $waitBluetoothSecs) {
ForEach(PowerIntervals.allCases) {
Text($0.description)
}
}
.pickerStyle(DefaultPickerStyle())
Picker("config.power.ls.secs", selection: $lsSecs) {
ForEach(PowerIntervals.allCases) {
Text($0.description)
}
}
.pickerStyle(DefaultPickerStyle())
Picker("config.power.min.wake.secs", selection: $minWakeSecs) {
ForEach(PowerIntervals.allCases) {
Text($0.description)
}
}
.pickerStyle(DefaultPickerStyle())
} header: {
Text("config.power.section.sleep")
}
// Section {
// Picker("power.wait.bluetooth.secs", selection: $waitBluetoothSecs) {
// ForEach(PowerIntervals.allCases) {
// Text($0.description)
// }
// }
// .pickerStyle(DefaultPickerStyle())
//
// Picker("power.ls.secs", selection: $lsSecs) {
// ForEach(PowerIntervals.allCases) {
// Text($0.description)
// }
// }
// .pickerStyle(DefaultPickerStyle())
//
// Picker("power.min.wake.secs", selection: $minWakeSecs) {
// ForEach(PowerIntervals.allCases) {
// Text($0.description)
// }
// }
// .pickerStyle(DefaultPickerStyle())
//
// } header: {
// Text("Sleep")
// }
}
}
.disabled(self.bleManager.connectedPeripheral == nil || node?.powerConfig == nil)
.navigationTitle("power.config")
.navigationTitle("config.power.title")
.navigationBarItems(trailing: ZStack {
ConnectedDevice(
bluetoothOn: bleManager.isSwitchedOn,

View file

@ -231,7 +231,7 @@ struct Settings: View {
} label: {
Image(systemName: "bolt.fill")
.symbolRenderingMode(.hierarchical)
Text("power")
Text("config.power.settings")
}
.tag(SettingsSidebar.powerConfig)
}

View file

@ -51,9 +51,22 @@
"clear.app.data"="Clear App Data";
"clear.log"="Clear";
"close"="Close";
"config.power.settings"="Power";
"config.power.title"="Power Config";
"config.power.section.battery"="Battery";
"config.power.section.sleep"="Sleep";
"config.power.adc.override"="ADC Override";
"config.power.adc.multiplier"="Multiplier";
"config.power.ls.secs"="Light Sleep Interval";
"config.power.min.wake.secs"="Minimum Wake Interval";
"config.power.saving"="Power Saving";
"config.power.saving.description"="Will sleep everything as much as possible, for the tracker and sensor role this will also include the lora radio. Don't use this setting if you want to use your device with the phone apps or are using a device without a user button.";
"config.power.shutdown.on.power.loss"="Shutdown on Power Loss";
"config.power.shutdown.after.secs"="After";
"config.power.wait.bluetooth.secs"="Bluetooth Off After";
"config.module.paxcounter.settings"="PAX Counter";
"config.module.paxcounter.title"="PAX Counter Config";
"config.module.paxcounter.enabled.description"="When enabled the PAX Counter module counts the number of people passing by using WiFi and Bluetooth.";
"config.module.paxcounter.enabled.description"="When enabled the PAX Counter module counts the number of people passing by using WiFi and Bluetooth. Both WiFI and Bluetooth must be enabled for PAX counter to work.";
"config.module.paxcounter.updateinterval"="Update Interval";
"config.module.paxcounter.updateinterval.description"="How often we can send a message to the mesh when people are detected.";
"config.save.confirm"="After config values save the node will reboot.";
@ -239,16 +252,6 @@
"position"="Position";
"position.config"="Position Config";
"position.precision %@"="Within %@";
"power"="Power";
"power.adc.override"="ADC Override";
"power.adc.multiplier"="Multiplier";
"power.config"="Power Config";
"power.ls.secs"="Light Sleep Interval";
"power.min.wake.secs"="Minimum Wake Interval";
"power.saving"="Power Saving";
"power.shutdown.on.power.loss"="Shutdown on Power Loss";
"power.shutdown.after.secs"="After";
"power.wait.bluetooth.secs"="Bluetooth Off After";
"preferred.radio"="Preferred Radio";
"radio.configuration"="Radio Configuration";
"range.test"="Range Test";