Skip to content

Commit cd0af7c

Browse files
♻️ Added withDisplayName string helper
1 parent 246934e commit cd0af7c

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

phpmon/Common/Extensions/StringExtension.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,10 @@ extension String {
164164
of: "^[0-9]*$", // 1
165165
options: .regularExpression) != nil
166166
}
167+
168+
// MARK: - Helpers
169+
170+
var withDisplayName: String {
171+
return self.replacing("PHP Monitor", with: App.displayName)
172+
}
167173
}

phpmon/Domain/App/App.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class App {
1717
/** Use to determine whether a loaded testable configuration is being used. */
1818
static var hasLoadedTestableConfiguration: Bool = false
1919

20-
/** The name of the app. Has EAP suffixed when an actual EAP build. */
21-
static var name: String {
20+
/** The display name of the app, as declared in Info.plist. */
21+
static var displayName: String {
2222
return Bundle.main.infoDictionary?["CFBundleName"] as! String
2323
}
2424

phpmon/Domain/Menu/StatusMenu+Items.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ extension StatusMenu {
127127
@MainActor func addCoreMenuItems() {
128128
addItems([
129129
NSMenuItem.separator(),
130-
NSMenuItem(title: "mi_about".localized.replacing("PHP Monitor", with: App.name),
130+
NSMenuItem(title: "mi_about".localized.withDisplayName,
131131
action: #selector(MainMenu.openAbout)),
132-
NSMenuItem(title: "mi_quit".localized.replacing("PHP Monitor", with: App.name),
132+
NSMenuItem(title: "mi_quit".localized.withDisplayName,
133133
action: #selector(MainMenu.terminateApp), keyEquivalent: "q")
134134
])
135135
}

0 commit comments

Comments
 (0)