Skip to content

Commit

Permalink
add German Localization
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyrilHD committed Dec 12, 2022
1 parent 5004b31 commit c96808d
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 24 deletions.
18 changes: 18 additions & 0 deletions HotApps.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
713B12E829401F2D004BEE2D /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 713B12E729401F2D004BEE2D /* main.swift */; };
713B12F62940203A004BEE2D /* HotAppsLauncher.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = 713B12E529401F2D004BEE2D /* HotAppsLauncher.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
713B12F929402063004BEE2D /* ServiceManagement.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 713B12F829402063004BEE2D /* ServiceManagement.framework */; };
7183326A2946F8AF00BE86C8 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7183326C2946F8AF00BE86C8 /* Localizable.strings */; };
718D9E80293AB6270029CCA5 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 718D9E7F293AB6270029CCA5 /* Settings.swift */; };
71E9A66129344F8A006C8926 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71E9A66029344F8A006C8926 /* AppDelegate.swift */; };
71E9A66529344F8A006C8926 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 71E9A66429344F8A006C8926 /* Assets.xcassets */; };
Expand Down Expand Up @@ -46,6 +47,8 @@
713B12E729401F2D004BEE2D /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
713B12F029401F2E004BEE2D /* HotAppsLauncher.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = HotAppsLauncher.entitlements; sourceTree = "<group>"; };
713B12F829402063004BEE2D /* ServiceManagement.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ServiceManagement.framework; path = System/Library/Frameworks/ServiceManagement.framework; sourceTree = SDKROOT; };
7183326B2946F8AF00BE86C8 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
7183326D2946F8DF00BE86C8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
718D9E7F293AB6270029CCA5 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = "<group>"; };
71E9A65D29344F8A006C8926 /* HotApps.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HotApps.app; sourceTree = BUILT_PRODUCTS_DIR; };
71E9A66029344F8A006C8926 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -121,6 +124,7 @@
71E9A66F29346CF4006C8926 /* main.swift */,
71E9A66429344F8A006C8926 /* Assets.xcassets */,
71E9A66929344F8A006C8926 /* HotApps.entitlements */,
7183326C2946F8AF00BE86C8 /* Localizable.strings */,
);
path = HotApps;
sourceTree = "<group>";
Expand Down Expand Up @@ -191,6 +195,7 @@
knownRegions = (
en,
Base,
de,
);
mainGroup = 71E9A65429344F8A006C8926;
productRefGroup = 71E9A65E29344F8A006C8926 /* Products */;
Expand All @@ -216,6 +221,7 @@
buildActionMask = 2147483647;
files = (
71E9A66529344F8A006C8926 /* Assets.xcassets in Resources */,
7183326A2946F8AF00BE86C8 /* Localizable.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -274,6 +280,18 @@
};
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
7183326C2946F8AF00BE86C8 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
7183326B2946F8AF00BE86C8 /* de */,
7183326D2946F8DF00BE86C8 /* en */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
713B12F129401F2E004BEE2D /* Debug */ = {
isa = XCBuildConfiguration;
Expand Down
4 changes: 2 additions & 2 deletions HotApps/AboutApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AboutApp: AppDelegate {
backing: .buffered, defer: false)
window!.center()
window!.level = NSWindow.Level.modalPanel
window?.title = "About HotApps"
window?.title = NSLocalizedString("about_hotapps", comment: "")

// Add logo to window
if let appIconImage = NSImage(named: "AppIcon"), appIconImage.isValid {
Expand All @@ -33,7 +33,7 @@ class AboutApp: AppDelegate {
// Add text to window
let year = Calendar.current.component(.year, from: Date())
let aboutText = NSTextField()
aboutText.stringValue = "Version: \(Bundle.main.infoDictionary!["CFBundleShortVersionString"]!)\n\nCopyright © \(year) SkyrilHD\nAll rights reserved"
aboutText.stringValue = "Version: \(Bundle.main.infoDictionary!["CFBundleShortVersionString"]!)\n\nCopyright © \(year) SkyrilHD\n"+NSLocalizedString("all_rights_reserved", comment: "")
aboutText.isEditable = false
aboutText.isSelectable = false
aboutText.isBezeled = false
Expand Down
20 changes: 10 additions & 10 deletions HotApps/Settings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Settings: NSWindowController, NSWindowDelegate, NSTextFieldDelegate {
self.window = NSWindow(contentRect: NSMakeRect(100, 100, NSScreen.main!.frame.width/2, NSScreen.main!.frame.height/2), styleMask: [.closable, .titled], backing: NSWindow.BackingStoreType.buffered, defer: false)

self.window?.level = NSWindow.Level.floating
self.window?.title = "HotApps Settings"
self.window?.title = NSLocalizedString("hotapps_settings", comment: "")

self.window?.delegate = self

Expand All @@ -59,7 +59,7 @@ class Settings: NSWindowController, NSWindowDelegate, NSTextFieldDelegate {

func topLeftSettings() {
// 'Top-left corner' toggle
genericSettings(type: tlButton, status: tlEnabled, input: "Enable top-left corner", checkbox: true)
genericSettings(type: tlButton, status: tlEnabled, input: NSLocalizedString("enable_tl_corner_setting", comment: ""), checkbox: true)
tlButton.frame = CGRect(x: 20, y: self.window!.frame.height-80, width: brButton.frame.width, height: tlButton.frame.height)
tlButton.tag = 1

Expand All @@ -75,7 +75,7 @@ class Settings: NSWindowController, NSWindowDelegate, NSTextFieldDelegate {

func topRightSettings() {
// 'Top-right corner' toggle
genericSettings(type: trButton, status: trEnabled, input: "Enable top-right corner", checkbox: true)
genericSettings(type: trButton, status: trEnabled, input: NSLocalizedString("enable_tr_corner_setting", comment: ""), checkbox: true)
trButton.frame = CGRect(x: 20, y: self.window!.frame.height-110, width: brButton.frame.width, height: trButton.frame.height)
trButton.tag = 2

Expand All @@ -91,7 +91,7 @@ class Settings: NSWindowController, NSWindowDelegate, NSTextFieldDelegate {

func bottomLeftSettings() {
// 'Bottom-left corner' toggle
genericSettings(type: blButton, status: blEnabled, input: "Enable bottom-left corner", checkbox: true)
genericSettings(type: blButton, status: blEnabled, input: NSLocalizedString("enable_bl_corner_setting", comment: ""), checkbox: true)
blButton.frame = CGRect(x: 20, y: self.window!.frame.height-140, width: brButton.frame.width, height: blButton.frame.height)
blButton.tag = 3

Expand All @@ -107,7 +107,7 @@ class Settings: NSWindowController, NSWindowDelegate, NSTextFieldDelegate {

func bottomRightSettings() {
// 'Bottom-right corner' toggle
genericSettings(type: brButton, status: brEnabled, input: "Enable bottom-right corner", checkbox: true)
genericSettings(type: brButton, status: brEnabled, input: NSLocalizedString("enable_br_corner_setting", comment: ""), checkbox: true)
brButton.frame = CGRect(x: 20, y: self.window!.frame.height-170, width: brButton.frame.width, height: brButton.frame.height)
brButton.tag = 4

Expand Down Expand Up @@ -157,7 +157,7 @@ class Settings: NSWindowController, NSWindowDelegate, NSTextFieldDelegate {
}

func delaySettings() {
genericSettings(type: msDelayLabel, status: true, input: "Detection delay (in ms):")
genericSettings(type: msDelayLabel, status: true, input: NSLocalizedString("detection_delay_label", comment: "")+":")
msDelayLabel.frame = CGRect(x: 20, y: self.window!.frame.height-220, width: msDelayLabel.frame.width, height: msDelayLabel.frame.height)
msDelayLabel.isBordered = false
msDelayLabel.isBezeled = false
Expand All @@ -171,19 +171,19 @@ class Settings: NSWindowController, NSWindowDelegate, NSTextFieldDelegate {
msDelayText.delegate = self
self.window?.contentView?.addSubview(msDelayText)

genericSettings(type: delayHideSetting, status: delayHide, input: "Apply delay when hiding apps", checkbox: true)
genericSettings(type: delayHideSetting, status: delayHide, input: NSLocalizedString("delay_on_hide", comment: ""), checkbox: true)
delayHideSetting.frame = CGRect(x: 20, y: self.window!.frame.height-270, width: delayHideSetting.frame.width, height: delayHideSetting.frame.height)
delayHideSetting.action = #selector(self.delayHideSwitch(_:))
}

func hideSettings() {
genericSettings(type: hideSetting, status: hideStatusBar, input: "Hide from status bar", checkbox: true)
genericSettings(type: hideSetting, status: hideStatusBar, input: NSLocalizedString("hide_statusbar", comment: ""), checkbox: true)
hideSetting.frame = CGRect(x: self.window!.frame.width-hideSetting.frame.width-20, y: self.window!.frame.height-220, width: hideSetting.frame.width, height: hideSetting.frame.height)
hideSetting.action = #selector(self.hideStatusBarSwitch(_:))
}

func startupSettings() {
genericSettings(type: startupSetting, status: startup, input: "Launch on Login", checkbox: true)
genericSettings(type: startupSetting, status: startup, input: NSLocalizedString("launch_on_login", comment: ""), checkbox: true)
startupSetting.frame = CGRect(x: self.window!.frame.width-hideSetting.frame.width-20, y: self.window!.frame.height-250, width: startupSetting.frame.width, height: startupSetting.frame.height)
startupSetting.action = #selector(self.startupSwitch(_:))
}
Expand Down Expand Up @@ -221,7 +221,7 @@ class Settings: NSWindowController, NSWindowDelegate, NSTextFieldDelegate {
button.state = status ? .on : .off
button.action = #selector(self.cornerSwitch(_:))
} else {
button.title = "Select"
button.title = NSLocalizedString("select", comment: "")
button.setButtonType(.momentaryPushIn)
button.target = self
button.isEnabled = status
Expand Down
24 changes: 12 additions & 12 deletions HotApps/StatusBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,34 @@ class StatusBar {
let nsmenu = NSMenu()

// 'About HotApps'
nsmenu.addItem(withTitle: "About HotApps", action: #selector(AppDelegate().aboutApp), keyEquivalent: "")
nsmenu.addItem(withTitle: NSLocalizedString("about_hotapps", comment: ""), action: #selector(AppDelegate().aboutApp), keyEquivalent: "")

nsmenu.addItem(NSMenuItem.separator())

// Show which apps are being used
nsmenu.addItem(withTitle: "Current HotApps:", action: nil, keyEquivalent: "")
nsmenu.addItem(withTitle: NSLocalizedString("current_hotapps", comment: "")+":", action: nil, keyEquivalent: "")

let tlStatus = tlEnabled ? tlApp.components(separatedBy: "/").last! : "Disabled"
nsmenu.addItem(withTitle: "\tTop-left: "+tlStatus, action: nil, keyEquivalent: "")
let tlStatus = tlEnabled ? tlApp.components(separatedBy: "/").last! : NSLocalizedString("disabled", comment: "")
nsmenu.addItem(withTitle: "\t\(NSLocalizedString("top-left_statusbar", comment: "")): "+tlStatus, action: nil, keyEquivalent: "")

let trStatus = trEnabled ? trApp.components(separatedBy: "/").last! : "Disabled"
nsmenu.addItem(withTitle: "\tTop-right: "+trStatus, action: nil, keyEquivalent: "")
let trStatus = trEnabled ? trApp.components(separatedBy: "/").last! : NSLocalizedString("disabled", comment: "")
nsmenu.addItem(withTitle: "\t\(NSLocalizedString("top-right_statusbar", comment: "")): "+trStatus, action: nil, keyEquivalent: "")

let blStatus = blEnabled ? blApp.components(separatedBy: "/").last! : "Disabled"
nsmenu.addItem(withTitle: "\tBottom-left: "+blStatus, action: nil, keyEquivalent: "")
let blStatus = blEnabled ? blApp.components(separatedBy: "/").last! : NSLocalizedString("disabled", comment: "")
nsmenu.addItem(withTitle: "\t\(NSLocalizedString("bottom-left_statusbar", comment: "")): "+blStatus, action: nil, keyEquivalent: "")

let brStatus = brEnabled ? brApp.components(separatedBy: "/").last! : "Disabled"
nsmenu.addItem(withTitle: "\tBottom-right: "+brStatus, action: nil, keyEquivalent: "")
let brStatus = brEnabled ? brApp.components(separatedBy: "/").last! : NSLocalizedString("disabled", comment: "")
nsmenu.addItem(withTitle: "\t\(NSLocalizedString("bottom-right_statusbar", comment: "")): "+brStatus, action: nil, keyEquivalent: "")

nsmenu.addItem(NSMenuItem.separator())

// 'Settings'
nsmenu.addItem(withTitle: "Settings", action: #selector(AppDelegate().openSettings), keyEquivalent: "")
nsmenu.addItem(withTitle: NSLocalizedString("settings", comment: ""), action: #selector(AppDelegate().openSettings), keyEquivalent: "")

nsmenu.addItem(NSMenuItem.separator())

// 'Quit'
nsmenu.addItem(withTitle: "Quit", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "")
nsmenu.addItem(withTitle: NSLocalizedString("quit", comment: ""), action: #selector(NSApplication.terminate(_:)), keyEquivalent: "")

// Apply NSMenu to status bar
statusItem.menu = nsmenu
Expand Down
33 changes: 33 additions & 0 deletions HotApps/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
Localizable.strings
HotApps

Created by SkyrilHD on 12.12.22.
Copyright © 2022 SkyrilHD. All rights reserved.
*/

// Status bar
"about_hotapps" = "Über HotApps";
"current_hotapps" = "Aktuelle HotApps";
"top-left_statusbar" = "Oben-links";
"top-right_statusbar" = "Oben-rechts";
"bottom-left_statusbar" = "Unten-links";
"bottom-right_statusbar" = "Unten-rechts";
"disabled" = "Deaktiviert";
"settings" = "Einstellungen";
"quit" = "HotApps beenden";

// 'About HotApps' window
"all_rights_reserved" = "Alle Rechte vorbehalten";

// 'Settings' window
"hotapps_settings" = "HotApps Einstellungen";
"enable_tl_corner_setting" = "Obere linke Ecke aktivieren";
"enable_tr_corner_setting" = "Obere rechte Ecke aktivieren";
"enable_bl_corner_setting" = "Untere linke Ecke aktivieren";
"enable_br_corner_setting" = "Untere rechte Ecke aktivieren";
"detection_delay_label" = "Erkennungsverzögerung (in ms)";
"delay_on_hide" = "Verzögerung beim Ausblenden von Apps anwenden";
"hide_statusbar" = "Aus Statusleiste ausblenden";
"launch_on_login" = "Beim Anmelden starten";
"select" = "Auswählen";
33 changes: 33 additions & 0 deletions HotApps/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
Localizable.strings
HotApps

Created by SkyrilHD on 12.12.22.
Copyright © 2022 SkyrilHD. All rights reserved.
*/

// Status bar
"about_hotapps" = "About HotApps";
"current_hotapps" = "Current HotApps";
"top-left_statusbar" = "Top-left";
"top-right_statusbar" = "Top-right";
"bottom-left_statusbar" = "Bottom-left";
"bottom-right_statusbar" = "Bottom-right";
"disabled" = "Disabled";
"settings" = "Settings";
"quit" = "Quit HotApps";

// 'About HotApps' window
"all_rights_reserved" = "All rights reserved";

// 'Settings' window
"hotapps_settings" = "HotApps Settings";
"enable_tl_corner_setting" = "Enable top-left corner";
"enable_tr_corner_setting" = "Enable top-right corner";
"enable_bl_corner_setting" = "Enable bottom-left corner";
"enable_br_corner_setting" = "Enable bottom-right corner";
"detection_delay_label" = "Detection delay (in ms)";
"delay_on_hide" = "Apply delay when hiding apps";
"hide_statusbar" = "Hide from status bar";
"launch_on_login" = "Launch on Login";
"select" = "Select";

0 comments on commit c96808d

Please sign in to comment.