feat: add translation to the modules name (#496)

This commit is contained in:
Serhiy Mytrovtsiy
2021-07-01 21:22:59 +02:00
parent 2e693cdd31
commit f136a2f9c8
4 changed files with 20 additions and 6 deletions

View File

@@ -285,7 +285,16 @@ 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 = title == "Stats" ? localizedString("Open application settings") : localizedString("Open moduleName settings", title)
var toolTip = ""
if title == "State" {
toolTip = localizedString("Open application settings")
} else if title == "Dashboard" {
toolTip = localizedString("Open dashboard")
} else {
toolTip = localizedString("Open \(title) settings")
}
self.toolTip = toolTip
let rect = NSRect(x: 0, y: 0, width: self.frame.width, height: self.frame.height)
let trackingArea = NSTrackingArea(
@@ -302,13 +311,15 @@ private class MenuView: NSView {
}
imageView.frame = NSRect(x: 8, y: (self.height - 18)/2, width: 18, height: 18)
imageView.wantsLayer = true
imageView.contentTintColor = .labelColor
if #available(OSX 10.14, *) {
imageView.contentTintColor = .labelColor
}
let titleView = TextView(frame: NSRect(x: 34, y: (self.height - 16)/2, width: 100, height: 16))
titleView.alignment = .natural
titleView.textColor = .labelColor
titleView.font = NSFont.systemFont(ofSize: 13, weight: .regular)
titleView.stringValue = title
titleView.stringValue = localizedString(title)
self.addSubview(imageView)
self.addSubview(titleView)