* - initialize localization with English
- add i18n to app settings

* - add translation to widget settings

* - add translation to CPU

* - add translation to GPU

* - add translation to Memory

* - add translation to Disk

* - add translation to Sensors
- add translation to Network

* - add translation to Battery

* - add Polish language
- small fixes in translation

* - add Ukrainian language
This commit is contained in:
Serhiy Mytrovtsiy
2020-08-30 13:23:40 +02:00
committed by GitHub
parent a05ec471af
commit a424dc871e
45 changed files with 822 additions and 131 deletions

View File

@@ -224,14 +224,14 @@ public class BarChart: Widget {
view.addSubview(ToggleTitleRow(
frame: NSRect(x: 0, y: (rowHeight + Constants.Settings.margin) * 3, width: view.frame.width, height: rowHeight),
title: "Label",
title: LocalizedString("Label"),
action: #selector(toggleLabel),
state: self.labelState
))
self.boxSettingsView = ToggleTitleRow(
frame: NSRect(x: 0, y: (rowHeight + Constants.Settings.margin) * 2, width: view.frame.width, height: rowHeight),
title: "Box",
title: LocalizedString("Box"),
action: #selector(toggleBox),
state: self.boxState
)
@@ -239,7 +239,7 @@ public class BarChart: Widget {
self.frameSettingsView = ToggleTitleRow(
frame: NSRect(x: 0, y: (rowHeight + Constants.Settings.margin) * 1, width: view.frame.width, height: rowHeight),
title: "Frame",
title: LocalizedString("Frame"),
action: #selector(toggleFrame),
state: self.frameState
)
@@ -247,7 +247,7 @@ public class BarChart: Widget {
view.addSubview(SelectColorRow(
frame: NSRect(x: 0, y: (rowHeight + Constants.Settings.margin) * 0, width: view.frame.width, height: rowHeight),
title: "Color",
title: LocalizedString("Color"),
action: #selector(toggleColor),
items: self.colors.map{ $0.rawValue },
selected: self.colorState.rawValue

View File

@@ -205,7 +205,7 @@ public class BatterykWidget: Widget {
view.addSubview(SelectTitleRow(
frame: NSRect(x: 0, y: rowHeight + Constants.Settings.margin, width: view.frame.width, height: rowHeight),
title: "Additional information",
title: LocalizedString("Additional information"),
action: #selector(toggleAdditional),
items: battery_additional_t.allCases.map{ return $0.rawValue },
selected: self.additional.rawValue
@@ -213,7 +213,7 @@ public class BatterykWidget: Widget {
view.addSubview(ToggleTitleRow(
frame: NSRect(x: 0, y: (rowHeight + Constants.Settings.margin) * 0, width: view.frame.width, height: rowHeight),
title: "Colorize",
title: LocalizedString("Colorize"),
action: #selector(toggleColor),
state: self.colorState
))

View File

@@ -202,21 +202,21 @@ public class LineChart: Widget {
view.addSubview(ToggleTitleRow(
frame: NSRect(x: 0, y: (rowHeight + Constants.Settings.margin) * 5, width: view.frame.width, height: rowHeight),
title: "Label",
title: LocalizedString("Label"),
action: #selector(toggleLabel),
state: self.labelState
))
view.addSubview(ToggleTitleRow(
frame: NSRect(x: 0, y: (rowHeight + Constants.Settings.margin) * 4, width: view.frame.width, height: rowHeight),
title: "Value",
title: LocalizedString("Value"),
action: #selector(toggleValue),
state: self.valueState
))
self.boxSettingsView = ToggleTitleRow(
frame: NSRect(x: 0, y: (rowHeight + Constants.Settings.margin) * 3, width: view.frame.width, height: rowHeight),
title: "Box",
title: LocalizedString("Box"),
action: #selector(toggleBox),
state: self.boxState
)
@@ -224,7 +224,7 @@ public class LineChart: Widget {
self.frameSettingsView = ToggleTitleRow(
frame: NSRect(x: 0, y: (rowHeight + Constants.Settings.margin) * 2, width: view.frame.width, height: rowHeight),
title: "Frame",
title: LocalizedString("Frame"),
action: #selector(toggleFrame),
state: self.frameState
)
@@ -232,7 +232,7 @@ public class LineChart: Widget {
view.addSubview(SelectColorRow(
frame: NSRect(x: 0, y: (rowHeight + Constants.Settings.margin) * 1, width: view.frame.width, height: rowHeight),
title: "Color",
title: LocalizedString("Color"),
action: #selector(toggleColor),
items: self.colors.map{ $0.rawValue },
selected: self.colorState.rawValue
@@ -240,7 +240,7 @@ public class LineChart: Widget {
view.addSubview(ToggleTitleRow(
frame: NSRect(x: 0, y: (rowHeight + Constants.Settings.margin) * 0, width: view.frame.width, height: rowHeight),
title: "Colorize value",
title: LocalizedString("Colorize value"),
action: #selector(toggleValueColor),
state: self.valueColorState
))

View File

@@ -107,7 +107,7 @@ public class MemoryWidget: Widget {
view.addSubview(ToggleTitleRow(
frame: NSRect(x: 0, y: (rowHeight + Constants.Settings.margin) * 0, width: view.frame.width, height: rowHeight),
title: "Reverse values order",
title: LocalizedString("Reverse values order"),
action: #selector(toggleOrder),
state: self.orderReversedState
))

View File

@@ -130,14 +130,14 @@ public class Mini: Widget {
view.addSubview(ToggleTitleRow(
frame: NSRect(x: 0, y: rowHeight + Constants.Settings.margin, width: view.frame.width, height: rowHeight),
title: "Label",
title: LocalizedString("Label"),
action: #selector(toggleLabel),
state: self.labelState
))
view.addSubview(SelectColorRow(
frame: NSRect(x: 0, y: (rowHeight + Constants.Settings.margin) * 0, width: view.frame.width, height: rowHeight),
title: "Color",
title: LocalizedString("Color"),
action: #selector(toggleColor),
items: self.colors.map{ $0.rawValue },
selected: self.colorState.rawValue

View File

@@ -214,7 +214,7 @@ public class SpeedWidget: Widget {
view.addSubview(SelectTitleRow(
frame: NSRect(x: 0, y: rowHeight + Constants.Settings.margin, width: view.frame.width, height: rowHeight),
title: "Pictogram",
title: LocalizedString("Pictogram"),
action: #selector(toggleIcon),
items: speed_icon_t.allCases.map{ return $0.rawValue },
selected: self.icon.rawValue
@@ -222,7 +222,7 @@ public class SpeedWidget: Widget {
view.addSubview(ToggleTitleRow(
frame: NSRect(x: 0, y: 0, width: view.frame.width, height: rowHeight),
title: "Value",
title: LocalizedString("Value"),
action: #selector(toggleValue),
state: self.valueState
))

View File

@@ -188,6 +188,7 @@ internal class HeaderView: NSView {
activity.isBordered = false
activity.action = #selector(openActivityMonitor)
activity.target = self
activity.toolTip = LocalizedString("Open Activity Monitor")
let title = NSTextField(frame: NSMakeRect(frame.width/4, (frame.height - 18)/2, frame.width/2, 18))
title.isEditable = false
@@ -213,6 +214,7 @@ internal class HeaderView: NSView {
settings.isBordered = false
settings.action = #selector(openMenu)
settings.target = self
settings.toolTip = LocalizedString("Open module settings")
self.addSubview(activity)
self.addSubview(title)

View File

@@ -318,7 +318,7 @@ class WidgetPreview: NSView {
self.layer?.borderColor = self.state ? NSColor.systemBlue.cgColor : NSColor(hexString: "#dddddd").cgColor
self.layer?.borderWidth = 1
self.toolTip = "Select \(widget.name) widget"
self.toolTip = LocalizedString("Select widget", widget.name)
widget.widthHandler = { [weak self] value in
self?.removeTrackingArea((self?.trackingAreas.first)!)

View File

@@ -133,13 +133,13 @@ public class Battery: Module {
}
if value.level <= notificationLevel && self.notification == nil {
var subtitle = "\((Int(value.level*100)))% remaining"
var subtitle = LocalizedString("Battery remaining", "\(Int(value.level*100))")
if value.timeToEmpty > 0 {
subtitle += " (\(Double(value.timeToEmpty*60).printSecondsToHoursMinutesSeconds()))"
}
self.notification = showNotification(
title: "Low battery",
title: LocalizedString("Low battery"),
subtitle: subtitle,
id: "battery-level",
icon: NSImage(named: NSImage.Name("low-battery"))!

View File

@@ -74,17 +74,17 @@ internal class Popup: NSView {
private func initDetails() {
let y: CGFloat = self.dashboardView!.frame.origin.y - Constants.Popup.separatorHeight
let separator = SeparatorView("Details", origin: NSPoint(x: 0, y: y), width: self.frame.width)
let separator = SeparatorView(LocalizedString("Details"), origin: NSPoint(x: 0, y: y), width: self.frame.width)
self.addSubview(separator)
let view: NSView = NSView(frame: NSRect(x: 0, y: separator.frame.origin.y - self.detailsHeight, width: self.frame.width, height: self.detailsHeight))
self.levelField = PopupRow(view, n: 3, title: "Level:", value: "")
self.sourceField = PopupRow(view, n: 2, title: "Source:", value: "")
let t = self.labelValue(view, n: 1, title: "Time:", value: "")
self.levelField = PopupRow(view, n: 3, title: "\(LocalizedString("Details"))Level:", value: "")
self.sourceField = PopupRow(view, n: 2, title: "\(LocalizedString("Source")):", value: "")
let t = self.labelValue(view, n: 1, title: "\(LocalizedString("Time")):", value: "")
self.timeLabelField = t.0
self.timeField = t.1
self.healthField = PopupRow(view, n: 0, title: "Health:", value: "")
self.healthField = PopupRow(view, n: 0, title: "\(LocalizedString("Health")):", value: "")
self.addSubview(view)
self.detailsView = view
@@ -105,14 +105,14 @@ internal class Popup: NSView {
private func initBattery() {
let y: CGFloat = self.detailsView!.frame.origin.y - Constants.Popup.separatorHeight
let separator = SeparatorView("Battery", origin: NSPoint(x: 0, y: y), width: self.frame.width)
let separator = SeparatorView(LocalizedString("Battery"), origin: NSPoint(x: 0, y: y), width: self.frame.width)
self.addSubview(separator)
let view: NSView = NSView(frame: NSRect(x: 0, y: separator.frame.origin.y - self.batteryHeight, width: self.frame.width, height: self.batteryHeight))
self.amperageField = PopupRow(view, n: 2, title: "Amperage:", value: "")
self.voltageField = PopupRow(view, n: 1, title: "Voltage:", value: "")
self.temperatureField = PopupRow(view, n: 0, title: "Temperature:", value: "")
self.amperageField = PopupRow(view, n: 2, title: "\(LocalizedString("Amperage")):", value: "")
self.voltageField = PopupRow(view, n: 1, title: "\(LocalizedString("Voltage")):", value: "")
self.temperatureField = PopupRow(view, n: 0, title: "\(LocalizedString("Temperature")):", value: "")
self.addSubview(view)
self.batteryView = view
@@ -120,20 +120,20 @@ internal class Popup: NSView {
private func initAdapter() {
let y: CGFloat = self.batteryView!.frame.origin.y - Constants.Popup.separatorHeight
let separator = SeparatorView("Power adapter", origin: NSPoint(x: 0, y: y), width: self.frame.width)
let separator = SeparatorView(LocalizedString("Power adapter"), origin: NSPoint(x: 0, y: y), width: self.frame.width)
self.addSubview(separator)
let view: NSView = NSView(frame: NSRect(x: 0, y: separator.frame.origin.y - self.adapterHeight, width: self.frame.width, height: self.adapterHeight))
self.powerField = PopupRow(view, n: 1, title: "Power:", value: "")
self.chargingStateField = PopupRow(view, n: 0, title: "Is charging:", value: "")
self.powerField = PopupRow(view, n: 1, title: "\(LocalizedString("Power")):", value: "")
self.chargingStateField = PopupRow(view, n: 0, title: "\(LocalizedString("Is charging")):", value: "")
self.addSubview(view)
self.adapterView = view
}
private func initProcesses() {
let separator = SeparatorView("Top processes", origin: NSPoint(x: 0, y: self.processesHeight), width: self.frame.width)
let separator = SeparatorView(LocalizedString("Top processes"), origin: NSPoint(x: 0, y: self.processesHeight), width: self.frame.width)
self.addSubview(separator)
let view: NSView = NSView(frame: NSRect(x: 0, y: 0, width: self.frame.width, height: self.processesHeight))
@@ -158,23 +158,23 @@ internal class Popup: NSView {
self.timeField?.stringValue = ""
if value.powerSource == "Battery Power" {
self.timeLabelField?.stringValue = "Time to discharge:"
self.timeLabelField?.stringValue = "\(LocalizedString("Time to discharge")):"
if value.timeToEmpty != -1 && value.timeToEmpty != 0 {
self.timeField?.stringValue = Double(value.timeToEmpty*60).printSecondsToHoursMinutesSeconds()
}
} else {
self.timeLabelField?.stringValue = "Time to charge:"
self.timeLabelField?.stringValue = "\(LocalizedString("Time to charge")):"
if value.timeToCharge != -1 && value.timeToCharge != 0 {
self.timeField?.stringValue = Double(value.timeToCharge*60).printSecondsToHoursMinutesSeconds()
}
}
if value.timeToEmpty == -1 || value.timeToCharge == -1 {
self.timeField?.stringValue = "Calculating"
self.timeField?.stringValue = LocalizedString("Calculating")
}
if value.isCharged {
self.timeField?.stringValue = "Fully charged"
self.timeField?.stringValue = LocalizedString("Fully charged")
}
self.healthField?.stringValue = "\(value.health) % (\(value.state))"
@@ -183,8 +183,8 @@ internal class Popup: NSView {
self.voltageField?.stringValue = "\(value.voltage.roundTo(decimalPlaces: 2)) V"
self.temperatureField?.stringValue = "\(value.temperature) °C"
self.powerField?.stringValue = value.powerSource == "Battery Power" ? "Not connected" : "\(value.ACwatts) W"
self.chargingStateField?.stringValue = value.isCharging ? "Yes" : "No"
self.powerField?.stringValue = value.powerSource == "Battery Power" ? LocalizedString("Not connected") : "\(value.ACwatts) W"
self.chargingStateField?.stringValue = value.isCharging ? LocalizedString("Yes") : LocalizedString("No")
})
}

View File

@@ -66,7 +66,7 @@ internal class Settings: NSView, Settings_v {
width: self.frame.width - (Constants.Settings.margin*2),
height: rowHeight
),
title: "Low level notification",
title: LocalizedString("Low level notification"),
action: #selector(changeUpdateInterval),
items: levels,
selected: self.lowLevelNotification == "Disabled" ? self.lowLevelNotification : "\(Int((Double(self.lowLevelNotification) ?? 0)*100))%"

View File

@@ -67,13 +67,13 @@ internal class Popup: NSView {
let container: NSView = NSView(frame: NSRect(x: 0, y: 10, width: view.frame.width, height: self.dashboardHeight-20))
self.circle = CircleGraphView(frame: NSRect(x: (container.frame.width - container.frame.height)/2, y: 0, width: container.frame.height, height: container.frame.height), segments: [])
self.circle!.toolTip = "CPU usage"
self.circle!.toolTip = LocalizedString("CPU usage")
container.addSubview(self.circle!)
let centralWidth: CGFloat = self.dashboardHeight-20
let sideWidth: CGFloat = (view.frame.width - centralWidth - (Constants.Popup.margins*2))/2
self.temperatureCircle = HalfCircleGraphView(frame: NSRect(x: (sideWidth - 60)/2, y: 10, width: 60, height: 50))
self.temperatureCircle!.toolTip = "CPU temperature"
self.temperatureCircle!.toolTip = LocalizedString("CPU temperature")
view.addSubview(self.temperatureCircle!)
view.addSubview(container)
@@ -83,7 +83,7 @@ internal class Popup: NSView {
private func initChart() {
let y: CGFloat = self.frame.height - self.dashboardHeight - Constants.Popup.separatorHeight
let separator = SeparatorView("Usage history", origin: NSPoint(x: 0, y: y), width: self.frame.width)
let separator = SeparatorView(LocalizedString("Usage history"), origin: NSPoint(x: 0, y: y), width: self.frame.width)
self.addSubview(separator)
let view: NSView = NSView(frame: NSRect(x: 0, y: y - self.chartHeight, width: self.frame.width, height: self.chartHeight))
@@ -100,20 +100,20 @@ internal class Popup: NSView {
private func initDetails() {
let y: CGFloat = self.frame.height - self.dashboardHeight - self.chartHeight - (Constants.Popup.separatorHeight*2)
let separator = SeparatorView("Details", origin: NSPoint(x: 0, y: y), width: self.frame.width)
let separator = SeparatorView(LocalizedString("Details"), origin: NSPoint(x: 0, y: y), width: self.frame.width)
self.addSubview(separator)
let view: NSView = NSView(frame: NSRect(x: 0, y: separator.frame.origin.y - self.detailsHeight, width: self.frame.width, height: self.detailsHeight))
self.systemField = PopupWithColorRow(view, color: NSColor.systemRed, n: 2, title: "System:", value: "")
self.userField = PopupWithColorRow(view, color: NSColor.systemBlue, n: 1, title: "User:", value: "")
self.idleField = PopupWithColorRow(view, color: NSColor.lightGray.withAlphaComponent(0.5), n: 0, title: "Idle:", value: "")
self.systemField = PopupWithColorRow(view, color: NSColor.systemRed, n: 2, title: "\(LocalizedString("System")):", value: "")
self.userField = PopupWithColorRow(view, color: NSColor.systemBlue, n: 1, title: "\(LocalizedString("User")):", value: "")
self.idleField = PopupWithColorRow(view, color: NSColor.lightGray.withAlphaComponent(0.5), n: 0, title: "\(LocalizedString("Idle")):", value: "")
self.addSubview(view)
}
private func initProcesses() {
let separator = SeparatorView("Top processes", origin: NSPoint(x: 0, y: self.processesHeight), width: self.frame.width)
let separator = SeparatorView(LocalizedString("Top processes"), origin: NSPoint(x: 0, y: self.processesHeight), width: self.frame.width)
self.addSubview(separator)
let view: NSView = NSView(frame: NSRect(x: 0, y: 0, width: self.frame.width, height: self.processesHeight))

View File

@@ -60,7 +60,7 @@ internal class Settings: NSView, Settings_v {
self.addSubview(SelectTitleRow(
frame: NSRect(x: Constants.Settings.margin, y: Constants.Settings.margin + (rowHeight + Constants.Settings.margin) * num, width: self.frame.width - (Constants.Settings.margin*2), height: rowHeight),
title: "Update interval",
title: LocalizedString("Update interval"),
action: #selector(changeUpdateInterval),
items: self.listOfUpdateIntervals.map{ "\($0) sec" },
selected: "\(self.updateIntervalValue) sec"
@@ -69,14 +69,14 @@ internal class Settings: NSView, Settings_v {
if widget == .barChart {
self.addSubview(ToggleTitleRow(
frame: NSRect(x: Constants.Settings.margin, y: Constants.Settings.margin + (rowHeight + Constants.Settings.margin) * 1, width: self.frame.width - (Constants.Settings.margin*2), height: rowHeight),
title: "Show usage per core",
title: LocalizedString("Show usage per core"),
action: #selector(toggleUsagePerCore),
state: self.usagePerCoreState
))
self.hyperthreadView = ToggleTitleRow(
frame: NSRect(x: Constants.Settings.margin, y: Constants.Settings.margin + (rowHeight + Constants.Settings.margin) * 0, width: self.frame.width - (Constants.Settings.margin*2), height: rowHeight),
title: "Show hyper-threading cores",
title: LocalizedString("Show hyper-threading cores"),
action: #selector(toggleMultithreading),
state: self.hyperthreadState
)

View File

@@ -157,7 +157,7 @@ internal class DiskView: NSView {
self.legendField = TextView(frame: NSRect(x: 0, y: 0, width: view.frame.width - 40, height: view.frame.height))
self.legendField?.font = NSFont.systemFont(ofSize: 11, weight: .light)
self.legendField?.stringValue = "Used \(Units(bytes: (self.size - free)).getReadableMemory()) from \(Units(bytes: self.size).getReadableMemory())"
self.legendField?.stringValue = LocalizedString("Used disk memory", Units(bytes: (self.size - free)).getReadableMemory(), Units(bytes: self.size).getReadableMemory())
self.percentageField = TextView(frame: NSRect(x: view.frame.width - 40, y: 0, width: 40, height: view.frame.height))
self.percentageField?.font = NSFont.systemFont(ofSize: 11, weight: .regular)
@@ -199,7 +199,7 @@ internal class DiskView: NSView {
DispatchQueue.main.async(execute: {
if (self.window?.isVisible ?? false) || !self.ready {
if self.legendField != nil {
self.legendField?.stringValue = "Used \(Units(bytes: (self.size - free)).getReadableMemory()) from \(Units(bytes: self.size).getReadableMemory())"
self.legendField?.stringValue = LocalizedString("Used disk memory", Units(bytes: (self.size - free)).getReadableMemory(), Units(bytes: self.size).getReadableMemory())
self.percentageField?.stringValue = "\(Int8((Double(self.size - free) / Double(self.size)) * 100))%"
}

View File

@@ -58,7 +58,7 @@ internal class Settings: NSView, Settings_v {
if widget != .speed {
self.addSubview(SelectTitleRow(
frame: NSRect(x: Constants.Settings.margin, y: Constants.Settings.margin + (rowHeight + Constants.Settings.margin) * 2, width: self.frame.width - (Constants.Settings.margin*2), height: rowHeight),
title: "Update interval",
title: LocalizedString("Update interval"),
action: #selector(changeUpdateInterval),
items: self.listOfUpdateIntervals.map{ "\($0) sec" },
selected: "\(self.updateIntervalValue) sec"
@@ -69,7 +69,7 @@ internal class Settings: NSView, Settings_v {
self.addSubview(ToggleTitleRow(
frame: NSRect(x: Constants.Settings.margin, y: Constants.Settings.margin + (rowHeight + Constants.Settings.margin) * 0, width: self.frame.width - (Constants.Settings.margin*2), height: rowHeight),
title: "Show removable disks",
title: LocalizedString("Show removable disks"),
action: #selector(toggleRemovable),
state: self.removableState
))
@@ -85,7 +85,7 @@ internal class Settings: NSView, Settings_v {
height: 30
))
let rowTitle: NSTextField = LabelField(frame: NSRect(x: 0, y: (view.frame.height - 16)/2, width: view.frame.width - 52, height: 17), "Disk to show")
let rowTitle: NSTextField = LabelField(frame: NSRect(x: 0, y: (view.frame.height - 16)/2, width: view.frame.width - 52, height: 17), LocalizedString("Disk to show"))
rowTitle.font = NSFont.systemFont(ofSize: 13, weight: .light)
rowTitle.textColor = .textColor

View File

@@ -141,7 +141,7 @@ private class GPUView: NSView {
width: circleSize,
height: circleSize
))
self.temperatureCirle!.toolTip = "GPU temperature"
self.temperatureCirle!.toolTip = LocalizedString("GPU temperature")
view.addSubview(chartView)
view.addSubview(self.temperatureCirle!)
@@ -185,7 +185,7 @@ private class GPUView: NSView {
width: circleSize,
height: circleSize
))
self.utilizationCircle!.toolTip = "GPU utilization"
self.utilizationCircle!.toolTip = LocalizedString("GPU utilization")
view.addSubview(chartView)
view.addSubview(self.utilizationCircle!)

View File

@@ -58,7 +58,7 @@ internal class Settings: NSView, Settings_v {
self.addSubview(SelectTitleRow(
frame: NSRect(x: Constants.Settings.margin, y: Constants.Settings.margin + (rowHeight + Constants.Settings.margin) * num, width: self.frame.width - (Constants.Settings.margin*2), height: rowHeight),
title: "Update interval",
title: LocalizedString("Update interval"),
action: #selector(changeUpdateInterval),
items: self.listOfUpdateIntervals.map{ "\($0) sec" },
selected: "\(self.updateIntervalValue) sec"
@@ -77,7 +77,7 @@ internal class Settings: NSView, Settings_v {
height: 30
))
let rowTitle: NSTextField = LabelField(frame: NSRect(x: 0, y: (view.frame.height - 16)/2, width: view.frame.width - 52, height: 17), "GPU to show")
let rowTitle: NSTextField = LabelField(frame: NSRect(x: 0, y: (view.frame.height - 16)/2, width: view.frame.width - 52, height: 17), LocalizedString("GPU to show"))
rowTitle.font = NSFont.systemFont(ofSize: 13, weight: .light)
rowTitle.textColor = .textColor

View File

@@ -64,13 +64,13 @@ internal class Popup: NSView {
let container: NSView = NSView(frame: NSRect(x: 0, y: 10, width: view.frame.width, height: self.dashboardHeight-20))
self.circle = CircleGraphView(frame: NSRect(x: (container.frame.width - container.frame.height)/2, y: 0, width: container.frame.height, height: container.frame.height), segments: [])
self.circle!.toolTip = "RAM usage"
self.circle!.toolTip = LocalizedString("Memory usage")
container.addSubview(self.circle!)
let centralWidth: CGFloat = self.dashboardHeight-20
let sideWidth: CGFloat = (view.frame.width - centralWidth - (Constants.Popup.margins*2))/2
self.level = PressureView(frame: NSRect(x: (sideWidth - 60)/2, y: 10, width: 60, height: 50))
self.level!.toolTip = "Memory pressure"
self.level!.toolTip = LocalizedString("Memory pressure")
view.addSubview(self.level!)
view.addSubview(container)
@@ -80,7 +80,7 @@ internal class Popup: NSView {
private func initChart() {
let y: CGFloat = self.frame.height - self.dashboardHeight - Constants.Popup.separatorHeight
let separator = SeparatorView("Usage history", origin: NSPoint(x: 0, y: y), width: self.frame.width)
let separator = SeparatorView(LocalizedString("Usage history"), origin: NSPoint(x: 0, y: y), width: self.frame.width)
self.addSubview(separator)
let view: NSView = NSView(frame: NSRect(x: 0, y: y - self.chartHeight, width: self.frame.width, height: self.chartHeight))
@@ -97,24 +97,24 @@ internal class Popup: NSView {
private func initDetails() {
let y: CGFloat = self.frame.height - self.dashboardHeight - self.chartHeight - (Constants.Popup.separatorHeight*2)
let separator = SeparatorView("Details", origin: NSPoint(x: 0, y: y), width: self.frame.width)
let separator = SeparatorView(LocalizedString("Details"), origin: NSPoint(x: 0, y: y), width: self.frame.width)
self.addSubview(separator)
let view: NSView = NSView(frame: NSRect(x: 0, y: separator.frame.origin.y - self.detailsHeight, width: self.frame.width, height: self.detailsHeight))
self.totalField = PopupRow(view, n: 5, title: "Total:", value: "")
self.usedField = PopupRow(view, n: 4, title: "Used:", value: "")
self.totalField = PopupRow(view, n: 5, title: "\(LocalizedString("Total")):", value: "")
self.usedField = PopupRow(view, n: 4, title: "\(LocalizedString("Used")):", value: "")
self.activeField = PopupWithColorRow(view, color: NSColor.systemBlue, n: 3, title: "App:", value: "")
self.wiredField = PopupWithColorRow(view, color: NSColor.systemOrange, n: 2, title: "Wired:", value: "")
self.compressedField = PopupWithColorRow(view, color: NSColor.systemPink, n: 1, title: "Compressed:", value: "")
self.freeField = PopupWithColorRow(view, color: NSColor.lightGray.withAlphaComponent(0.5), n: 0, title: "Free:", value: "")
self.activeField = PopupWithColorRow(view, color: NSColor.systemBlue, n: 3, title: "\(LocalizedString("App")):", value: "")
self.wiredField = PopupWithColorRow(view, color: NSColor.systemOrange, n: 2, title: "\(LocalizedString("Wired")):", value: "")
self.compressedField = PopupWithColorRow(view, color: NSColor.systemPink, n: 1, title: "\(LocalizedString("Compressed")):", value: "")
self.freeField = PopupWithColorRow(view, color: NSColor.lightGray.withAlphaComponent(0.5), n: 0, title: "\(LocalizedString("Free")):", value: "")
self.addSubview(view)
}
private func initProcesses() {
let separator = SeparatorView("Top processes", origin: NSPoint(x: 0, y: self.processesHeight), width: self.frame.width)
let separator = SeparatorView(LocalizedString("Top processes"), origin: NSPoint(x: 0, y: self.processesHeight), width: self.frame.width)
self.addSubview(separator)
let view: NSView = NSView(frame: NSRect(x: 0, y: 0, width: self.frame.width, height: self.processesHeight))

View File

@@ -51,7 +51,7 @@ internal class Settings: NSView, Settings_v {
self.addSubview(SelectTitleRow(
frame: NSRect(x: Constants.Settings.margin, y: Constants.Settings.margin + (rowHeight + Constants.Settings.margin) * num, width: self.frame.width - (Constants.Settings.margin*2), height: rowHeight),
title: "Update interval",
title: LocalizedString("Update interval"),
action: #selector(changeUpdateInterval),
items: self.listOfUpdateIntervals.map{ "\($0) sec" },
selected: "\(self.updateIntervalValue) sec"

View File

@@ -67,14 +67,14 @@ internal class Popup: NSView {
let view: NSView = NSView(frame: NSRect(x: 0, y: self.frame.height - self.dashboardHeight, width: self.frame.width, height: self.dashboardHeight))
let leftPart: NSView = NSView(frame: NSRect(x: 0, y: 0, width: view.frame.width / 2, height: view.frame.height))
let uploadFields = self.topValueView(leftPart, title: "Upload", color: NSColor.systemRed)
let uploadFields = self.topValueView(leftPart, title: LocalizedString("Uploading"), color: NSColor.systemRed)
self.uploadView = uploadFields.0
self.uploadValueField = uploadFields.1
self.uploadUnitField = uploadFields.2
self.uploadStateView = uploadFields.3
let rightPart: NSView = NSView(frame: NSRect(x: view.frame.width / 2, y: 0, width: view.frame.width / 2, height: view.frame.height))
let downloadFields = self.topValueView(rightPart, title: "Download", color: NSColor.systemBlue)
let downloadFields = self.topValueView(rightPart, title: LocalizedString("Downloading"), color: NSColor.systemBlue)
self.downloadView = downloadFields.0
self.downloadValueField = downloadFields.1
self.downloadUnitField = downloadFields.2
@@ -88,7 +88,7 @@ internal class Popup: NSView {
private func initChart() {
let y: CGFloat = self.frame.height - self.dashboardHeight - Constants.Popup.separatorHeight
let separator = SeparatorView("Usage history", origin: NSPoint(x: 0, y: y), width: self.frame.width)
let separator = SeparatorView(LocalizedString("Usage history"), origin: NSPoint(x: 0, y: y), width: self.frame.width)
self.addSubview(separator)
let view: NSView = NSView(frame: NSRect(x: 0, y: y - self.chartHeight, width: self.frame.width, height: self.chartHeight))
@@ -105,26 +105,26 @@ internal class Popup: NSView {
private func initDetails() {
let y: CGFloat = self.frame.height - self.dashboardHeight - self.chartHeight - (Constants.Popup.separatorHeight*2)
let separator = SeparatorView("Details", origin: NSPoint(x: 0, y: y), width: self.frame.width)
let separator = SeparatorView(LocalizedString("Details"), origin: NSPoint(x: 0, y: y), width: self.frame.width)
self.addSubview(separator)
let view: NSView = NSView(frame: NSRect(x: 0, y: separator.frame.origin.y - self.detailsHeight, width: self.frame.width, height: self.detailsHeight))
self.publicIPField = PopupRow(view, n: 4, title: "Public IP:", value: "")
self.localIPField = PopupRow(view, n: 3, title: "Local IP:", value: "")
self.interfaceField = PopupRow(view, n: 2, title: "Interface:", value: "")
self.ssidField = PopupRow(view, n: 1, title: "Network:", value: "")
self.macAdressField = PopupRow(view, n: 0, title: "Physical address:", value: "")
self.publicIPField = PopupRow(view, n: 4, title: "\(LocalizedString("Public IP")):", value: "")
self.localIPField = PopupRow(view, n: 3, title: "\(LocalizedString("Local IP")):", value: "")
self.interfaceField = PopupRow(view, n: 2, title: "\(LocalizedString("Interface")):", value: "")
self.ssidField = PopupRow(view, n: 1, title: "\(LocalizedString("Network")):", value: "")
self.macAdressField = PopupRow(view, n: 0, title: "\(LocalizedString("Physical address")):", value: "")
self.publicIPField?.addTracking()
self.localIPField?.addTracking()
self.ssidField?.addTracking()
self.macAdressField?.addTracking()
self.publicIPField?.toolTip = "Click to copy public IP address"
self.localIPField?.toolTip = "Click to copy local IP address"
self.ssidField?.toolTip = "Click to copy wifi name"
self.macAdressField?.toolTip = "Click to copy mac address"
self.publicIPField?.toolTip = LocalizedString("Click to copy public IP address")
self.localIPField?.toolTip = LocalizedString("Click to copy local IP address")
self.ssidField?.toolTip = LocalizedString("Click to copy wifi name")
self.macAdressField?.toolTip = LocalizedString("Click to copy mac address")
self.publicIPField?.isSelectable = true
self.localIPField?.isSelectable = true
@@ -135,7 +135,7 @@ internal class Popup: NSView {
}
private func initProcesses() {
let separator = SeparatorView("Top processes", origin: NSPoint(x: 0, y: self.processesHeight), width: self.frame.width)
let separator = SeparatorView(LocalizedString("Top processes"), origin: NSPoint(x: 0, y: self.processesHeight), width: self.frame.width)
self.addSubview(separator)
let view: NSView = NSView(frame: NSRect(x: 0, y: 0, width: self.frame.width, height: self.processesHeight))
@@ -237,19 +237,19 @@ internal class Popup: NSView {
self.interfaceField?.stringValue = "\(interface.displayName) (\(interface.BSDName))"
self.macAdressField?.stringValue = interface.address
} else {
self.interfaceField?.stringValue = "Unknown"
self.macAdressField?.stringValue = "Unknown"
self.interfaceField?.stringValue = LocalizedString("Unknown")
self.macAdressField?.stringValue = LocalizedString("Unknown")
}
if value.connectionType == .wifi {
self.ssidField?.stringValue = value.ssid ?? "Unknown"
} else {
self.ssidField?.stringValue = "Unavailable"
self.ssidField?.stringValue = LocalizedString("Unavailable")
}
if self.publicIPField?.stringValue != value.raddr {
if value.raddr == nil {
self.publicIPField?.stringValue = "Unknown"
self.publicIPField?.stringValue = LocalizedString("Unknown")
} else {
if value.countryCode == nil {
self.publicIPField?.stringValue = value.raddr!
@@ -259,7 +259,7 @@ internal class Popup: NSView {
}
}
if self.localIPField?.stringValue != value.laddr {
self.localIPField?.stringValue = value.laddr ?? "Unknown"
self.localIPField?.stringValue = value.laddr ?? LocalizedString("Unknown")
}
self.initialized = true
@@ -295,7 +295,7 @@ extension ValueField {
}
public override func mouseEntered(with: NSEvent) {
guard self.stringValue != "No connection" && self.stringValue != "Unknown" && self.stringValue != "Unavailable" else {
guard self.stringValue != LocalizedString("No connection") && self.stringValue != LocalizedString("Unknown") && self.stringValue != LocalizedString("Unavailable") else {
return
}
@@ -307,7 +307,7 @@ extension ValueField {
}
public override func mouseDown(with: NSEvent) {
guard self.stringValue != "No connection" && self.stringValue != "Unknown" && self.stringValue != "Unavailable" else {
guard self.stringValue != LocalizedString("No connection") && self.stringValue != LocalizedString("Unknown") && self.stringValue != LocalizedString("Unavailable") else {
return
}

View File

@@ -60,7 +60,7 @@ internal class Settings: NSView, Settings_v {
private func addNetworkSelector() {
let view: NSView = NSView(frame: NSRect(x: Constants.Settings.margin, y: Constants.Settings.margin, width: self.frame.width, height: 30))
let rowTitle: NSTextField = LabelField(frame: NSRect(x: 0, y: (view.frame.height - 16)/2, width: view.frame.width - 52, height: 17), "Network interface")
let rowTitle: NSTextField = LabelField(frame: NSRect(x: 0, y: (view.frame.height - 16)/2, width: view.frame.width - 52, height: 17), LocalizedString("Network interface"))
rowTitle.font = NSFont.systemFont(ofSize: 13, weight: .light)
rowTitle.textColor = .textColor

View File

@@ -66,7 +66,7 @@ internal class Settings: NSView, Settings_v {
self.addSubview(SelectTitleRow(
frame: NSRect(x: Constants.Settings.margin, y: height - rowHeight, width: view.frame.width, height: rowHeight),
title: "Update interval",
title: LocalizedString("Update interval"),
action: #selector(changeUpdateInterval),
items: self.listOfUpdateIntervals.map{ "\($0) sec" },
selected: "\(self.updateIntervalValue) sec"

View File

@@ -75,6 +75,7 @@
9A944D5F24492AA60058F32A /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A944D5E24492AA60058F32A /* Constants.swift */; };
9A944D6124492B6D0058F32A /* popup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A944D6024492B6D0058F32A /* popup.swift */; };
9A953A1424B9D22D0038EF4B /* settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A953A1324B9D22D0038EF4B /* settings.swift */; };
9A9B25BB24F7DE2B00C3CCE6 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9A9B25BD24F7DE2B00C3CCE6 /* Localizable.strings */; };
9A9D728A24471FAE005CF997 /* SMC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A9D728924471FAE005CF997 /* SMC.swift */; };
9A9EA9452476D34500E3B883 /* Update.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA9442476D34500E3B883 /* Update.swift */; };
9AA4A00A2443656D00ECCF07 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9AA4A0092443656D00ECCF07 /* Assets.xcassets */; };
@@ -498,6 +499,7 @@
9A953A1324B9D22D0038EF4B /* settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = settings.swift; sourceTree = "<group>"; };
9A998CD722A199920087ADE7 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
9A998CD922A199970087ADE7 /* ServiceManagement.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ServiceManagement.framework; path = System/Library/Frameworks/ServiceManagement.framework; sourceTree = SDKROOT; };
9A9B25BC24F7DE2B00C3CCE6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
9A9D728924471FAE005CF997 /* SMC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SMC.swift; sourceTree = "<group>"; };
9A9EA9442476D34500E3B883 /* Update.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Update.swift; sourceTree = "<group>"; };
9AA4A0092443656D00ECCF07 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@@ -505,6 +507,8 @@
9AA64261244B57C800416A33 /* settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = settings.swift; sourceTree = "<group>"; };
9AA64263244B94F300416A33 /* LineChart.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineChart.swift; sourceTree = "<group>"; };
9AA95A6324DD7C6300801B69 /* Bridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Bridge.h; sourceTree = "<group>"; };
9AAAE83524F953FC00CD92D7 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; };
9AAAE83624FAA4B700CD92D7 /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Localizable.strings; sourceTree = "<group>"; };
9AABEADD243FB13500668CB0 /* ModuleKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ModuleKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9AABEAE0243FB13500668CB0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9AABEAE9243FB15E00668CB0 /* module.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = module.swift; sourceTree = "<group>"; };
@@ -735,6 +739,7 @@
9A6CFC0022A1C9F5001E782D /* Assets.xcassets */,
9AABEB7D243FDEF100668CB0 /* main.swift */,
9A141101229E721200D29793 /* Info.plist */,
9A9B25BD24F7DE2B00C3CCE6 /* Localizable.strings */,
);
path = "Supporting Files";
sourceTree = "<group>";
@@ -1265,7 +1270,8 @@
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
pl,
uk,
);
mainGroup = 9A1410EC229E721100D29793;
productRefGroup = 9A1410F6229E721100D29793 /* Products */;
@@ -1301,6 +1307,7 @@
buildActionMask = 2147483647;
files = (
9A6CFC0122A1C9F5001E782D /* Assets.xcassets in Resources */,
9A9B25BB24F7DE2B00C3CCE6 /* Localizable.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1636,6 +1643,19 @@
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
9A9B25BD24F7DE2B00C3CCE6 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
9A9B25BC24F7DE2B00C3CCE6 /* en */,
9AAAE83524F953FC00CD92D7 /* pl */,
9AAAE83624FAA4B700CD92D7 /* uk */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
9A0C82E424460F7200FAE3D4 /* Debug */ = {
isa = XCBuildConfiguration;
@@ -1718,6 +1738,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
@@ -1779,6 +1800,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
@@ -1852,7 +1874,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 2.3.1;
MARKETING_VERSION = 2.3.0;
PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.Stats;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -1884,7 +1906,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 2.3.1;
MARKETING_VERSION = 2.3.0;
PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.Stats;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

View File

@@ -0,0 +1,190 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 http://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd">
<file original="LaunchAtLogin/en.lproj/InfoPlist.strings" source-language="en" target-language="en" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="11.6" build-num="11E708"/>
</header>
<body>
<trans-unit id="CFBundleName" xml:space="preserve">
<source>LaunchAtLogin</source>
<target>LaunchAtLogin</target>
<note>Bundle name</note>
</trans-unit>
<trans-unit id="NSHumanReadableCopyright" xml:space="preserve">
<source>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</source>
<target>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</target>
<note>Copyright (human-readable)</note>
</trans-unit>
</body>
</file>
<file original="ModuleKit/Supporting Files/en.lproj/InfoPlist.strings" source-language="en" target-language="en" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="11.6" build-num="11E708"/>
</header>
<body>
<trans-unit id="CFBundleName" xml:space="preserve">
<source>ModuleKit</source>
<target>ModuleKit</target>
<note>Bundle name</note>
</trans-unit>
<trans-unit id="NSHumanReadableCopyright" xml:space="preserve">
<source>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</source>
<target>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</target>
<note>Copyright (human-readable)</note>
</trans-unit>
</body>
</file>
<file original="Modules/Battery/en.lproj/InfoPlist.strings" source-language="en" target-language="en" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="11.6" build-num="11E708"/>
</header>
<body>
<trans-unit id="CFBundleName" xml:space="preserve">
<source>Battery</source>
<target>Battery</target>
<note>Bundle name</note>
</trans-unit>
<trans-unit id="NSHumanReadableCopyright" xml:space="preserve">
<source>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</source>
<target>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</target>
<note>Copyright (human-readable)</note>
</trans-unit>
</body>
</file>
<file original="Modules/CPU/en.lproj/InfoPlist.strings" source-language="en" target-language="en" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="11.6" build-num="11E708"/>
</header>
<body>
<trans-unit id="CFBundleName" xml:space="preserve">
<source>CPU</source>
<target>CPU</target>
<note>Bundle name</note>
</trans-unit>
<trans-unit id="NSHumanReadableCopyright" xml:space="preserve">
<source>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</source>
<target>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</target>
<note>Copyright (human-readable)</note>
</trans-unit>
</body>
</file>
<file original="Modules/Disk/en.lproj/InfoPlist.strings" source-language="en" target-language="en" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="11.6" build-num="11E708"/>
</header>
<body>
<trans-unit id="CFBundleName" xml:space="preserve">
<source>Disk</source>
<target>Disk</target>
<note>Bundle name</note>
</trans-unit>
<trans-unit id="NSHumanReadableCopyright" xml:space="preserve">
<source>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</source>
<target>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</target>
<note>Copyright (human-readable)</note>
</trans-unit>
</body>
</file>
<file original="Modules/GPU/en.lproj/InfoPlist.strings" source-language="en" target-language="en" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="11.6" build-num="11E708"/>
</header>
<body>
<trans-unit id="CFBundleName" xml:space="preserve">
<source>GPU</source>
<target>GPU</target>
<note>Bundle name</note>
</trans-unit>
<trans-unit id="NSHumanReadableCopyright" xml:space="preserve">
<source>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</source>
<target>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</target>
<note>Copyright (human-readable)</note>
</trans-unit>
</body>
</file>
<file original="Modules/Memory/en.lproj/InfoPlist.strings" source-language="en" target-language="en" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="11.6" build-num="11E708"/>
</header>
<body>
<trans-unit id="CFBundleName" xml:space="preserve">
<source>Memory</source>
<target>Memory</target>
<note>Bundle name</note>
</trans-unit>
<trans-unit id="NSHumanReadableCopyright" xml:space="preserve">
<source>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</source>
<target>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</target>
<note>Copyright (human-readable)</note>
</trans-unit>
</body>
</file>
<file original="Modules/Net/en.lproj/InfoPlist.strings" source-language="en" target-language="en" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="11.6" build-num="11E708"/>
</header>
<body>
<trans-unit id="CFBundleName" xml:space="preserve">
<source>Net</source>
<target>Net</target>
<note>Bundle name</note>
</trans-unit>
<trans-unit id="NSHumanReadableCopyright" xml:space="preserve">
<source>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</source>
<target>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</target>
<note>Copyright (human-readable)</note>
</trans-unit>
</body>
</file>
<file original="Modules/Sensors/en.lproj/InfoPlist.strings" source-language="en" target-language="en" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="11.6" build-num="11E708"/>
</header>
<body>
<trans-unit id="CFBundleName" xml:space="preserve">
<source>Sensors</source>
<target>Sensors</target>
<note>Bundle name</note>
</trans-unit>
<trans-unit id="NSHumanReadableCopyright" xml:space="preserve">
<source>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</source>
<target>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</target>
<note>Copyright (human-readable)</note>
</trans-unit>
</body>
</file>
<file original="Stats/Supporting Files/en.lproj/InfoPlist.strings" source-language="en" target-language="en" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="11.6" build-num="11E708"/>
</header>
<body>
<trans-unit id="CFBundleName" xml:space="preserve">
<source>Stats</source>
<target>Stats</target>
<note>Bundle name</note>
</trans-unit>
<trans-unit id="NSHumanReadableCopyright" xml:space="preserve">
<source>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</source>
<target>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</target>
<note>Copyright (human-readable)</note>
</trans-unit>
</body>
</file>
<file original="StatsKit/en.lproj/InfoPlist.strings" source-language="en" target-language="en" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="11.6" build-num="11E708"/>
</header>
<body>
<trans-unit id="CFBundleName" xml:space="preserve">
<source>StatsKit</source>
<target>StatsKit</target>
<note>Bundle name</note>
</trans-unit>
<trans-unit id="NSHumanReadableCopyright" xml:space="preserve">
<source>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</source>
<target>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</target>
<note>Copyright (human-readable)</note>
</trans-unit>
</body>
</file>
</xliff>

View File

@@ -0,0 +1,4 @@
/* Bundle name */
"CFBundleName" = "LaunchAtLogin";
/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.";

View File

@@ -0,0 +1,4 @@
/* Bundle name */
"CFBundleName" = "ModuleKit";
/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.";

View File

@@ -0,0 +1,4 @@
/* Bundle name */
"CFBundleName" = "Battery";
/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.";

View File

@@ -0,0 +1,4 @@
/* Bundle name */
"CFBundleName" = "CPU";
/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.";

View File

@@ -0,0 +1,4 @@
/* Bundle name */
"CFBundleName" = "Disk";
/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.";

View File

@@ -0,0 +1,4 @@
/* Bundle name */
"CFBundleName" = "GPU";
/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.";

View File

@@ -0,0 +1,4 @@
/* Bundle name */
"CFBundleName" = "Memory";
/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.";

View File

@@ -0,0 +1,4 @@
/* Bundle name */
"CFBundleName" = "Net";
/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.";

View File

@@ -0,0 +1,4 @@
/* Bundle name */
"CFBundleName" = "Sensors";
/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.";

View File

@@ -0,0 +1,4 @@
/* Bundle name */
"CFBundleName" = "Stats";
/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.";

View File

@@ -0,0 +1,7 @@
/*
Localizable.strings
Stats
Created by Samuel Grant on 27/08/2020.
Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.
*/

View File

@@ -0,0 +1,4 @@
/* Bundle name */
"CFBundleName" = "StatsKit";
/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.";

View File

@@ -0,0 +1,11 @@
{
"developmentRegion" : "en",
"targetLocale" : "en",
"toolInfo" : {
"toolBuildNumber" : "11E708",
"toolID" : "com.apple.dt.xcode",
"toolName" : "Xcode",
"toolVersion" : "11.6"
},
"version" : "1.0"
}

View File

@@ -0,0 +1,134 @@
//
// Localizable.strings
// Stats
//
// Created by Serhiy Mytrovtsiy on 27/08/2020.
// Using Swift 5.0.
// Running on macOS 10.15.
//
// Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.
//
// Words
"Unknown" = "Unknown";
"Version" = "Version";
"Processor" = "Processor";
"Memory" = "Memory";
"Graphics" = "Graphics";
"Disk" = "Disk";
"Close" = "Close";
"Download" = "Download";
"Install" = "Install";
"Cancel" = "Cancel";
"Unavailable" = "Unavailable";
"Yes" = "Yes";
"No" = "No";
// Alerts
"New version available" = "New version available";
"Click to install the new version of Stats" = "Click to install the new version of Stats";
"Successfully updated" = "Successfully updated";
"Stats was updated to v" = "Stats was updated to v%@";
// Settings
"Open Activity Monitor" = "Open Activity Monitor";
"Report a bug" = "Report a bug";
"Close application" = "Close application";
"Open application settings" = "Open application settings";
"Open moduleName settings" = "Open %@ settings";
// Application settings
"Update application" = "Update application";
"Check for updates" = "Check for updates";
"Show icon in dock" = "Show icon in dock";
"Start at login" = "Start at login";
// Update
"The latest version of Stats installed" = "The latest version of Stats installed";
"Downloading..." = "Downloading...";
"Current version: " = "Current version: ";
"Latest version: " = "Latest version: ";
// Widgets
"Color" = "Color";
"Label" = "Label";
"Box" = "Box";
"Frame" = "Frame";
"Value" = "Value";
"Colorize" = "Colorize";
"Colorize value" = "Colorize value";
"Additional information" = "Additional information";
"Reverse values order" = "Reverse values order";
// Module Kit
"Open module settings" = "Open module settings";
"Select widget" = "Select %@ widget";
"Update interval" = "Update interval";
"Usage history" = "Usage history";
"Details" = "Details";
"Top processes" = "Top processes";
"Pictogram" = "Pictogram";
// CPU
"CPU usage" = "CPU usage";
"CPU temperature" = "CPU temperature";
"System" = "System";
"User" = "User";
"Idle" = "Idle";
"Show usage per core" = "Show usage per core";
"Show hyper-threading cores" = "Show hyper-threading cores";
// GPU
"GPU to show" = "GPU to show";
"GPU temperature" = "GPU temperature";
"GPU utilization" = "GPU utilization";
// Memory
"Memory usage" = "Memory usage";
"Memory pressure" = "Memory pressure";
"Total" = "Total";
"Used" = "Used";
"App" = "App";
"Wired" = "Wired";
"Compressed" = "Compressed";
"Free" = "Free";
// Disk
"Show removable disks" = "Show removable disks";
"Used disk memory" = "Used %@ from %@";
"Disk to show" = "Disk to show";
// Network
"Uploading" = "Upload";
"Downloading" = "Download";
"Public IP" = "Public IP";
"Local IP" = "Local IP";
"Interface" = "Interface";
"Network" = "Network";
"Physical address" = "Physical address";
"Click to copy public IP address" = "Click to copy public IP address";
"Click to copy local IP address" = "Click to copy local IP address";
"Click to copy wifi name" = "Click to copy wifi name";
"Click to copy mac address" = "Click to copy mac address";
"No connection" = "No connection";
"Network interface" = "Network interface";
// Battery
"Source" = "Source";
"Time" = "Time";
"Health" = "Health";
"Battery" = "Battery";
"Amperage" = "Amperage";
"Voltage" = "Voltage";
"Temperature" = "Temperature";
"Power adapter" = "Power adapter";
"Power" = "Power";
"Is charging" = "Is charging";
"Time to discharge" = "Time to discharge";
"Time to charge" = "Time to charge";
"Calculating" = "Calculating";
"Fully charged" = "Fully charged";
"Not connected" = "Not connected";
"Low level notification" = "Low level notification";
"Low battery" = "Low battery";
"Battery remaining" = "%@% remaining";

View File

@@ -0,0 +1,134 @@
//
// Localizable.strings
// Stats
//
// Created by Serhiy Mytrovtsiy on 27/08/2020.
// Using Swift 5.0.
// Running on macOS 10.15.
//
// Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.
//
// Words
"Unknown" = "Unknown";
"Version" = "Wersja";
"Processor" = "Procesor";
"Memory" = "Pamięć";
"Graphics" = "Grafika";
"Disk" = "Dysk";
"Close" = "Zamknij";
"Download" = "Pobierz";
"Install" = "Zainstaluj";
"Cancel" = "Cancel";
"Unavailable" = "Niedostępny";
"Yes" = "Tak";
"No" = "Nie";
// Alerts
"New version available" = "Nowa wersja dostępna";
"Click to install the new version of Stats" = "Kliknij aby zainstalować nową wersję";
"Successfully updated" = "Zaktualizowano pomyślnie";
"Stats was updated to v" = "Stats został zaktualizowany do v%@";
// Settings
"Open Activity Monitor" = "Otwórz Activity Monitor";
"Report a bug" = "Zgłoś problem";
"Close application" = "Zamknij program";
"Open application settings" = "Otwórz ustawienie";
"Open moduleName settings" = "Otwórz ustawienie %@";
// Application settings
"Update application" = "Aktualizuj aplikacje";
"Check for updates" = "Sprawdzaj aktualizacje";
"Show icon in dock" = "Pokaż ikonę w docku";
"Start at login" = "Uruchom przy logowaniu";
// Update
"The latest version of Stats installed" = "Najnowsza wersja Stats zainstalowana";
"Downloading..." = "Pobieranie...";
"Current version: " = "Aktualna wersja: ";
"Latest version: " = "Najnowsza wersja: ";
// Widgets
"Color" = "Kolor";
"Label" = "Etykieta";
"Box" = "Box";
"Frame" = "Ramka";
"Value" = "Wartość";
"Colorize" = "Kolorowanie";
"Colorize value" = "Kolorowanie wartości";
"Additional information" = "Informacja dodatkowa";
"Reverse values order" = "Zmień kolejność wyświetlania";
// Module Kit
"Open module settings" = "Otwórz ustawienie modulu";
"Select widget" = "Wybierz %@ widget";
"Update interval" = "Interwał odświeżania";
"Usage history" = "Historia zużycia";
"Details" = "Szczegóły";
"Top processes" = "Top procesy";
"Pictogram" = "Ikonka";
// CPU
"CPU usage" = "Obciążenie CPU";
"CPU temperature" = "Temperatura CPU";
"System" = "System";
"User" = "Użytkownik";
"Idle" = "Bezczynna";
"Show usage per core" = "Pokaż obciążenie na rdzeń";
"Show hyper-threading cores" = "Pokaż rdzenie Hyper-Threading";
// GPU
"GPU to show" = "GPU do wyświetlania";
"GPU temperature" = "Temperatura GPU";
"GPU utilization" = "Obciążenie GPU";
// Memory
"Memory usage" = "Wykorzystanie pamięci";
"Memory pressure" = "Poziom obciążenia";
"Total" = "Całość";
"Used" = "Użyta";
"App" = "Aplikacje";
"Wired" = "Układowa";
"Compressed" = "Skompresowana";
"Free" = "Wolna";
// Disk
"Show removable disks" = "Pokaż dyski wymienne";
"Used disk memory" = "Wykorzystano %@ z %@";
"Disk to show" = "Aktywny dysk";
// Network
"Uploading" = "Wysyłka";
"Downloading" = "Pobieranie";
"Public IP" = "Publiczny IP";
"Local IP" = "Lokalny IP";
"Interface" = "Interfejs";
"Network" = "Sieć";
"Physical address" = "Adres fizyczny";
"Click to copy public IP address" = "Kliknij aby skopiować publiczny adres IP";
"Click to copy local IP address" = "Kliknij aby skopiować lokalny adres IP";
"Click to copy wifi name" = "Kliknij aby skopiować nazwę Wi-Fi";
"Click to copy mac address" = "Kliknij aby skopiować adres fizyczny";
"No connection" = "Brak połączenia";
"Network interface" = "Interfejs sieciowy";
// Battery
"Source" = "Źródło";
"Time" = "Czas";
"Health" = "Zdrowie";
"Battery" = "Bateria";
"Amperage" = "Natężenie";
"Voltage" = "Napięcie";
"Temperature" = "Termaratura";
"Power adapter" = "Zasilacz";
"Power" = "Status";
"Is charging" = "Ładuje";
"Time to discharge" = "Czas do rozładowania";
"Time to charge" = "Czas do naładowania";
"Calculating" = "Obliczenie";
"Fully charged" = "W pełni naładowana";
"Not connected" = "Nie podłączona";
"Low level notification" = "Powiadomienie o niskim poziomie";
"Low battery" = "Niski poziom baterii";
"Battery remaining" = "Pozostało %@%";

View File

@@ -0,0 +1,134 @@
//
// Localizable.strings
// Stats
//
// Created by Serhiy Mytrovtsiy on 27/08/2020.
// Using Swift 5.0.
// Running on macOS 10.15.
//
// Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.
//
// Words
"Unknown" = "Невідомо";
"Version" = "Версія";
"Processor" = "Процесор";
"Memory" = "Память";
"Graphics" = "Графіка";
"Disk" = "Диск";
"Close" = "Закрити";
"Download" = "Завантажити";
"Install" = "Встановити";
"Cancel" = "Скасувати";
"Unavailable" = "Недоступно";
"Yes" = "Так";
"No" = "Ні";
// Alerts
"New version available" = "Доступна нова версія";
"Click to install the new version of Stats" = "Натисніть щоб встановити нову версію Stats";
"Successfully updated" = "Успішно оновленно";
"Stats was updated to v" = "Stats оновлено до v%@";
// Settings
"Open Activity Monitor" = "Відкрити Монітор активності";
"Report a bug" = "Повідомити про помилку";
"Close application" = "Закрити програму";
"Open application settings" = "Відкрити налаштування";
"Open moduleName settings" = "Відкрити налаштування %@";
// Application settings
"Update application" = "Оновити програму";
"Check for updates" = "Перевірити оновленя";
"Show icon in dock" = "Показувати іконку в dock";
"Start at login" = "Запуск при логуванні";
// Update
"The latest version of Stats installed" = "Встановлено останню версію";
"Downloading..." = "Завантаження...";
"Current version: " = "Поточна версія: ";
"Latest version: " = "Остання версія: ";
// Widgets
"Color" = "Колір";
"Label" = "Етикетка";
"Box" = "Box";
"Frame" = "Рамка";
"Value" = "Значення";
"Colorize" = "Розфарбувати";
"Colorize value" = "Розфарбувати значення";
"Additional information" = "Додаткова інформація";
"Reverse values order" = "Змінити порядок сортування";
// Module Kit
"Open module settings" = "Відкрити налаштування модуля";
"Select widget" = "Активувати %@ віджет";
"Update interval" = "Інтервал обновлень";
"Usage history" = "Історія використання";
"Details" = "Деталі";
"Top processes" = "Топ процесів";
"Pictogram" = "Піктограма";
// CPU
"CPU usage" = "Використання процесора";
"CPU temperature" = "Температура процесора";
"System" = "Система";
"User" = "Користувач";
"Idle" = "Вільно";
"Show usage per core" = "Показати використання на одне ядро";
"Show hyper-threading cores" = "Показати Hyper-Threading ядра";
// GPU
"GPU to show" = "Активний графічний процесор";
"GPU temperature" = "Температура графічного процесора";
"GPU utilization" = "Навантаженість графічного процесора";
// Memory
"Memory usage" = "Навантаженість пам’яті";
"Memory pressure" = "Рівень навантаження";
"Total" = "Загально";
"Used" = "Використовується";
"App" = "Програми";
"Wired" = "Постійна";
"Compressed" = "Стисненна";
"Free" = "Вільна";
// DiskF
"Show removable disks" = "Показати знімні диски";
"Used disk memory" = "Використано %@ з %@";
"Disk to show" = "Активний диск";
// Network
"Uploading" = "Висилання";
"Downloading" = "Завантаження";
"Public IP" = "Публічний IP";
"Local IP" = "Локальний IP";
"Interface" = "Інтерфейс";
"Network" = "Мережа";
"Physical address" = "Фізичний адрес";
"Click to copy public IP address" = "Натисніть, щоб скопіювати публічний IP";
"Click to copy local IP address" = "Натисніть, щоб скопіювати локальний IP";
"Click to copy wifi name" = "Натисніть, щоб скопіювати назву wifi";
"Click to copy mac address" = "Натисніть, щоб скопіювати фізичний адрес";
"No connection" = "Немає з'єднання";
"Network interface" = "Мережевий інтерфейс";
// Battery
"Source" = "Джерело";
"Time" = "Час";
"Health" = "Стан батареї";
"Battery" = "Акумулятор";
"Amperage" = "Сила струму";
"Voltage" = "Напруга";
"Temperature" = "Температура";
"Power adapter" = "Блок живлення";
"Power" = "Статус";
"Is charging" = "Заряджається";
"Time to discharge" = "Час до розрядки";
"Time to charge" = "Час до зарядки";
"Calculating" = "Обчислення";
"Fully charged" = "Повністю заряджений";
"Not connected" = "Непід'єднана";
"Low level notification" = "Повідомлення про низький рівень заряду";
"Low battery" = "Низький заряд батареї";
"Battery remaining" = "%@% залишилось";

View File

@@ -43,9 +43,9 @@ class ApplicationSettings: NSView {
public override func viewDidMoveToWindow() {
if let button = self.updateButton, let version = updater.latest {
if version.newest {
button.title = "Update application"
button.title = LocalizedString("Update application")
} else {
button.title = "Check for updates"
button.title = LocalizedString("Check for updates")
}
}
}
@@ -60,12 +60,12 @@ class ApplicationSettings: NSView {
var processorInfo = ""
if systemKit.device.info?.cpu?.name != "" {
processorInfo += "\(systemKit.device.info?.cpu?.name ?? "Unknown")\n"
processorInfo += "\(systemKit.device.info?.cpu?.name ?? LocalizedString("Unknown"))\n"
}
processorInfo += "\(systemKit.device.info?.cpu?.physicalCores ?? 0) cores (\(systemKit.device.info?.cpu?.logicalCores ?? 0) threads)"
leftPanel.addSubview(makeInfoRow(
frame: NSRect(x: rowHorizontalPadding, y: rowHeight*3, width: leftPanel.frame.width - (rowHorizontalPadding*1.5), height: rowHeight+8),
title: "Processor",
title: LocalizedString("Processor"),
value: processorInfo
))
@@ -74,12 +74,12 @@ class ApplicationSettings: NSView {
sizeFormatter.countStyle = .memory
leftPanel.addSubview(makeInfoRow(
frame: NSRect(x: rowHorizontalPadding, y: rowHeight*2, width: leftPanel.frame.width - (rowHorizontalPadding*1.5), height: rowHeight),
title: "Memory",
title: LocalizedString("Memory"),
value: "\(sizeFormatter.string(fromByteCount: Int64(systemKit.device.info?.ram?.total ?? 0)))"
))
let gpus = systemKit.device.info?.gpu
var gpu: String = "Unknown"
var gpu: String = LocalizedString("Unknown")
if gpus != nil {
if gpus?.count == 1 {
gpu = gpus![0].name
@@ -90,21 +90,21 @@ class ApplicationSettings: NSView {
}
leftPanel.addSubview(makeInfoRow(
frame: NSRect(x: rowHorizontalPadding, y: rowHeight*1, width: leftPanel.frame.width - (rowHorizontalPadding*1.5), height: rowHeight),
title: "GPU",
title: LocalizedString("Graphics"),
value: gpu
))
leftPanel.addSubview(makeInfoRow(
frame: NSRect(x: rowHorizontalPadding, y: 0, width: leftPanel.frame.width - (rowHorizontalPadding*1.5), height: rowHeight),
title: "Disk",
value: "\(systemKit.device.info?.disk?.model ?? systemKit.device.info?.disk?.name ?? "Unknown")"
title: LocalizedString("Disk"),
value: "\(systemKit.device.info?.disk?.model ?? systemKit.device.info?.disk?.name ?? LocalizedString("Unknown"))"
))
let rightPanel: NSView = NSView(frame: NSRect(x: self.width/2, y: 0, width: view.frame.width/2, height: view.frame.height))
rightPanel.addSubview(makeSelectRow(
frame: NSRect(x: rowHorizontalPadding*0.5, y: rowHeight*2, width: rightPanel.frame.width - (rowHorizontalPadding*1.5), height: rowHeight),
title: "Check for updates",
title: LocalizedString("Check for updates"),
action: #selector(self.toggleUpdateInterval),
items: updateIntervals.allCases.map{ $0.rawValue },
selected: self.updateIntervalValue
@@ -112,14 +112,14 @@ class ApplicationSettings: NSView {
rightPanel.addSubview(makeSettingRow(
frame: NSRect(x: rowHorizontalPadding*0.5, y: rowHeight*1, width: rightPanel.frame.width - (rowHorizontalPadding*1.5), height: rowHeight),
title: "Show icon in dock",
title: LocalizedString("Show icon in dock"),
action: #selector(self.toggleDock),
state: store.bool(key: "dockIcon", defaultValue: false)
))
rightPanel.addSubview(makeSettingRow(
frame: NSRect(x: rowHorizontalPadding*0.5, y: 0, width: rightPanel.frame.width - (rowHorizontalPadding*1.5), height: rowHeight),
title: "Start at login",
title: LocalizedString("Start at login"),
action: #selector(self.toggleLaunchAtLogin),
state: LaunchAtLogin.isEnabled
))
@@ -242,7 +242,7 @@ class ApplicationSettings: NSView {
let osField: NSTextField = TextView(frame: NSRect(x: 0, y: 52, width: leftPanel.frame.width, height: 18))
osField.alignment = .center
osField.font = NSFont.systemFont(ofSize: 12, weight: .regular)
osField.stringValue = "macOS \(systemKit.device.os?.name ?? "Unknown") (\(systemKit.device.os?.version.getFullVersion() ?? ""))"
osField.stringValue = "macOS \(systemKit.device.os?.name ?? LocalizedString("Unknown")) (\(systemKit.device.os?.version.getFullVersion() ?? ""))"
osField.isSelectable = true
leftPanel.addSubview(deviceImageView)
@@ -266,14 +266,14 @@ class ApplicationSettings: NSView {
statsVersion.alignment = .center
statsVersion.font = NSFont.systemFont(ofSize: 12, weight: .regular)
let versionNumber = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String
statsVersion.stringValue = "Version \(versionNumber)"
statsVersion.stringValue = "\(LocalizedString("Version")) \(versionNumber)"
statsVersion.isSelectable = true
infoView.addSubview(statsName)
infoView.addSubview(statsVersion)
let button: NSButton = NSButton(frame: NSRect(x: (rightPanel.frame.width - 160)/2, y: 20, width: 160, height: 28))
button.title = "Check for updates"
button.title = LocalizedString("Check for updates")
button.bezelStyle = .rounded
button.target = self
button.action = #selector(updateAction)

View File

@@ -130,9 +130,9 @@ private class SettingsView: NSView {
let buttonsView: NSView = NSView(frame: NSRect(x: 0, y: 0, width: navigationWidth, height: buttonHeight))
buttonsView.wantsLayer = true
buttonsView.addSubview(self.makeButton(4, title: "Open Activity Monitor", image: "chart", action: #selector(openActivityMonitor)))
buttonsView.addSubview(self.makeButton(3, title: "Report a bug", image: "bug", action: #selector(reportBug)))
buttonsView.addSubview(self.makeButton(1, title: "Close application", image: "power", action: #selector(closeApp)))
buttonsView.addSubview(self.makeButton(4, title: LocalizedString("Open Activity Monitor"), image: "chart", action: #selector(openActivityMonitor)))
buttonsView.addSubview(self.makeButton(3, title: LocalizedString("Report a bug"), image: "bug", action: #selector(reportBug)))
buttonsView.addSubview(self.makeButton(1, title: LocalizedString("Close application"), image: "power", action: #selector(closeApp)))
let mainView: NSView = NSView(frame: NSRect(x: navigationWidth, y: 1, width: frame.width - navigationWidth-1, height: frame.height-1))
mainView.wantsLayer = true
@@ -300,7 +300,7 @@ private class MenuView: NSView {
super.init(frame: NSRect(x: 0, y: self.height*CGFloat(n), width: width, height: self.height))
self.wantsLayer = true
self.layer?.backgroundColor = .clear
self.toolTip = "Open \(title == "Stats" ? "application" : "\(title) module") settings"
self.toolTip = title == "Stats" ? LocalizedString("Open application settings") : LocalizedString("Open moduleName settings", title)
let rect = NSRect(x: 0, y: 0, width: self.frame.width, height: self.frame.height)
let trackingArea = NSTrackingArea(rect: rect, options: [NSTrackingArea.Options.activeAlways, NSTrackingArea.Options.mouseEnteredAndExited, NSTrackingArea.Options.activeInActiveApp], owner: self, userInfo: ["menu": title])

View File

@@ -97,9 +97,9 @@ private class UpdateView: NSView {
let title: NSTextField = TextView(frame: NSRect(x: 0, y: view.frame.height - 20, width: view.frame.width, height: 18))
title.font = NSFont.systemFont(ofSize: 14, weight: .semibold)
title.alignment = .center
title.stringValue = "New version available"
title.stringValue = LocalizedString("New version available")
let currentVersionString = "Current version: \(version.current)"
let currentVersionString = "\(LocalizedString("Current version: "))\(version.current)"
let currentVersionWidth = currentVersionString.widthOfString(usingFont: .systemFont(ofSize: 13, weight: .light))
let currentVersion: NSTextField = TextView(frame: NSRect(
x: (view.frame.width-currentVersionWidth)/2,
@@ -109,7 +109,7 @@ private class UpdateView: NSView {
))
currentVersion.stringValue = currentVersionString
let latestVersionString = "Latest version: \(version.latest)"
let latestVersionString = "\(LocalizedString("Latest version: "))\(version.latest)"
let latestVersionWidth = latestVersionString.widthOfString(usingFont: .systemFont(ofSize: 13, weight: .light))
let latestVersion: NSTextField = TextView(frame: NSRect(
x: (view.frame.width-currentVersionWidth)/2,
@@ -120,13 +120,13 @@ private class UpdateView: NSView {
latestVersion.stringValue = latestVersionString
let closeButton: NSButton = NSButton(frame: NSRect(x: 0, y: 0, width: view.frame.width/2, height: 26))
closeButton.title = "Close"
closeButton.title = LocalizedString("Close")
closeButton.bezelStyle = .rounded
closeButton.action = #selector(self.close)
closeButton.target = self
let downloadButton: NSButton = NSButton(frame: NSRect(x: view.frame.width/2, y: 0, width: view.frame.width/2, height: 26))
downloadButton.title = "Download"
downloadButton.title = LocalizedString("Download")
downloadButton.bezelStyle = .rounded
downloadButton.action = #selector(self.download)
downloadButton.target = self
@@ -145,10 +145,10 @@ private class UpdateView: NSView {
let title: NSTextField = TextView(frame: NSRect(x: 0, y: ((view.frame.height - 18)/2)+20, width: view.frame.width, height: 18))
title.font = NSFont.systemFont(ofSize: 14, weight: .regular)
title.alignment = .center
title.stringValue = "The latest version of Stats installed"
title.stringValue = LocalizedString("The latest version of Stats installed")
let button: NSButton = NSButton(frame: NSRect(x: 0, y: 0, width: view.frame.width, height: 26))
button.title = "Close"
button.title = LocalizedString("Close")
button.bezelStyle = .rounded
button.action = #selector(self.close)
button.target = self
@@ -174,7 +174,7 @@ private class UpdateView: NSView {
let title: NSTextField = TextView(frame: NSRect(x: 0, y: view.frame.height - 28, width: view.frame.width, height: 18))
title.font = NSFont.systemFont(ofSize: 14, weight: .semibold)
title.alignment = .center
title.stringValue = "Downloading..."
title.stringValue = LocalizedString("Downloading...")
let progressBar: NSProgressIndicator = NSProgressIndicator()
progressBar.frame = NSRect(x: 20, y: 64, width: view.frame.width - 40, height: 22)
@@ -189,13 +189,13 @@ private class UpdateView: NSView {
state.stringValue = "0%"
let closeButton: NSButton = NSButton(frame: NSRect(x: 0, y: 0, width: view.frame.width, height: 26))
closeButton.title = "Close"
closeButton.title = LocalizedString("Cancel")
closeButton.bezelStyle = .rounded
closeButton.action = #selector(self.close)
closeButton.target = self
let installButton: NSButton = NSButton(frame: NSRect(x: view.frame.width/2, y: 0, width: view.frame.width/2, height: 26))
installButton.title = "Install"
installButton.title = LocalizedString("Install")
installButton.bezelStyle = .rounded
installButton.action = #selector(self.install)
installButton.target = self

View File

@@ -67,7 +67,10 @@ extension AppDelegate {
}
if IsNewestVersion(currentVersion: prevVersion, latestVersion: currentVersion) {
_ = showNotification(title: "Successfully updated", subtitle: "Stats was updated to v\(currentVersion)", id: "updated-from-\(prevVersion)-to-\(currentVersion)"
_ = showNotification(
title: LocalizedString("Successfully updated"),
subtitle: LocalizedString("Stats was updated to v", currentVersion),
id: "updated-from-\(prevVersion)-to-\(currentVersion)"
)
}
@@ -110,12 +113,12 @@ extension AppDelegate {
os_log(.debug, log: log, "show update window because new version of app found: %s", "\(version.latest)")
self.updateNotification.identifier = "new-version-\(version.latest)"
self.updateNotification.title = "New version available"
self.updateNotification.subtitle = "Click to install the new version of Stats"
self.updateNotification.title = LocalizedString("New version available")
self.updateNotification.subtitle = LocalizedString("Click to install the new version of Stats")
self.updateNotification.soundName = NSUserNotificationDefaultSoundName
self.updateNotification.hasActionButton = true
self.updateNotification.actionButtonTitle = "Install"
self.updateNotification.actionButtonTitle = LocalizedString("Install")
self.updateNotification.userInfo = ["url": version.url]
NSUserNotificationCenter.default.delegate = self

View File

@@ -952,3 +952,13 @@ public struct Log: TextOutputStream {
}
}
}
public func LocalizedString(_ key: String, _ params: String..., comment: String = "") -> String {
var string = NSLocalizedString(key, comment: comment)
if !params.isEmpty {
for param in params {
string = string.replacingOccurrences(of: "%@", with: param)
}
}
return string
}