From 6b54f8331c8638ba4fc365f15530d1c7786e07ad Mon Sep 17 00:00:00 2001 From: Abhishek Date: Sat, 21 Sep 2019 12:02:49 -0700 Subject: [PATCH] Localization is a pain. --- Clocker/Clocker.xcodeproj/project.pbxproj | 8 +++--- Clocker/Clocker/en.lproj/Localizable.strings | 4 +++ Clocker/Clocker/hi.lproj/Localizable.strings | 14 +++++++++++ .../FinalOnboardingViewController.swift | 2 ++ Clocker/Onboarding/Onboarding.storyboard | 7 +++--- .../OnboardingParentViewController.swift | 25 +++++++++++++------ .../OnboardingPermissionsViewController.swift | 12 ++++++--- .../OnboardingWelcomeViewController.swift | 22 ++++++++++++++++ .../StartAtLoginViewController.swift | 1 + Clocker/Onboarding/WelcomeView.xib | 7 +++--- .../Onboarding/WelcomeViewController.swift | 20 --------------- 11 files changed, 78 insertions(+), 44 deletions(-) create mode 100644 Clocker/Onboarding/OnboardingWelcomeViewController.swift delete mode 100644 Clocker/Onboarding/WelcomeViewController.swift diff --git a/Clocker/Clocker.xcodeproj/project.pbxproj b/Clocker/Clocker.xcodeproj/project.pbxproj index 563b7a7..af15244 100755 --- a/Clocker/Clocker.xcodeproj/project.pbxproj +++ b/Clocker/Clocker.xcodeproj/project.pbxproj @@ -13,7 +13,7 @@ 35C36EE622595EFD002FA5C6 /* StatusItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35C36EE222595EFD002FA5C6 /* StatusItemView.swift */; }; 35C36EE722595EFD002FA5C6 /* StatusItemHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35C36EE322595EFD002FA5C6 /* StatusItemHandler.swift */; }; 35C36EF122595F14002FA5C6 /* OnboardingPermissionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35C36EE822595F13002FA5C6 /* OnboardingPermissionsViewController.swift */; }; - 35C36EF222595F14002FA5C6 /* WelcomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35C36EE922595F13002FA5C6 /* WelcomeViewController.swift */; }; + 35C36EF222595F14002FA5C6 /* OnboardingWelcomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35C36EE922595F13002FA5C6 /* OnboardingWelcomeViewController.swift */; }; 35C36EF322595F14002FA5C6 /* WelcomeView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 35C36EEA22595F13002FA5C6 /* WelcomeView.xib */; }; 35C36EF422595F14002FA5C6 /* StartAtLoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35C36EEB22595F13002FA5C6 /* StartAtLoginViewController.swift */; }; 35C36EF522595F14002FA5C6 /* OnboardingSearchController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35C36EEC22595F13002FA5C6 /* OnboardingSearchController.swift */; }; @@ -226,7 +226,7 @@ 35C36EE222595EFD002FA5C6 /* StatusItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusItemView.swift; sourceTree = ""; }; 35C36EE322595EFD002FA5C6 /* StatusItemHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusItemHandler.swift; sourceTree = ""; }; 35C36EE822595F13002FA5C6 /* OnboardingPermissionsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingPermissionsViewController.swift; sourceTree = ""; }; - 35C36EE922595F13002FA5C6 /* WelcomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WelcomeViewController.swift; sourceTree = ""; }; + 35C36EE922595F13002FA5C6 /* OnboardingWelcomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingWelcomeViewController.swift; sourceTree = ""; }; 35C36EEA22595F13002FA5C6 /* WelcomeView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = WelcomeView.xib; sourceTree = ""; }; 35C36EEB22595F13002FA5C6 /* StartAtLoginViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StartAtLoginViewController.swift; sourceTree = ""; }; 35C36EEC22595F13002FA5C6 /* OnboardingSearchController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingSearchController.swift; sourceTree = ""; }; @@ -741,7 +741,7 @@ 35C36EEC22595F13002FA5C6 /* OnboardingSearchController.swift */, 35C36EEB22595F13002FA5C6 /* StartAtLoginViewController.swift */, 35C36EEA22595F13002FA5C6 /* WelcomeView.xib */, - 35C36EE922595F13002FA5C6 /* WelcomeViewController.swift */, + 35C36EE922595F13002FA5C6 /* OnboardingWelcomeViewController.swift */, ); path = Onboarding; sourceTree = ""; @@ -1140,7 +1140,7 @@ 9AB6F1622259D1B000A44663 /* PreferencesDataSource.swift in Sources */, 35C36F672259DF4C002FA5C6 /* RateController.swift in Sources */, 35C36F472259D892002FA5C6 /* Reach.swift in Sources */, - 35C36EF222595F14002FA5C6 /* WelcomeViewController.swift in Sources */, + 35C36EF222595F14002FA5C6 /* OnboardingWelcomeViewController.swift in Sources */, 35C36F732259E1AA002FA5C6 /* FloatingWindowController.swift in Sources */, 35C36F6F2259E185002FA5C6 /* CustomSliderCell.swift in Sources */, 35C36EF122595F14002FA5C6 /* OnboardingPermissionsViewController.swift in Sources */, diff --git a/Clocker/Clocker/en.lproj/Localizable.strings b/Clocker/Clocker/en.lproj/Localizable.strings index 97f4e00..37f68a0 100644 --- a/Clocker/Clocker/en.lproj/Localizable.strings +++ b/Clocker/Clocker/en.lproj/Localizable.strings @@ -32,6 +32,10 @@ "Denied Button Text" = "Denied"; "Grant Button Text" = "Grant"; +// Welcome Onboarding +"It only takes 3 steps to setup Clocker." = "It only takes 3 steps to setup Clocker."; +"Get Started" = "Get Started"; + // Tab Item Titles "Preferences Tab" = "Preferences"; "Appearance Tab" = "Appearance"; diff --git a/Clocker/Clocker/hi.lproj/Localizable.strings b/Clocker/Clocker/hi.lproj/Localizable.strings index 0bf4f18..6dd92b8 100644 --- a/Clocker/Clocker/hi.lproj/Localizable.strings +++ b/Clocker/Clocker/hi.lproj/Localizable.strings @@ -52,3 +52,17 @@ "Max Search Characters" = "Only 50 characters allowed!"; "Add Button Title" = "ऐड "; "Close Button Title" = "बंद करे"; + +// Welcome Onboarding +"It only takes 3 steps to set up Clocker." = "बस तीन स्टेप् और एप्लिकेशन तैयार।"; +"Get Started" = "शुरु करे"; + +// Permissions +"Calendar Access Title" = "कैलेंडर एक्सेस"; +"Reminders Access Title" = "रिमाइंडर एक्सेस"; +"Later Config Description" = "इन्हें बाद में सिस्टम प्राथमिकता में कॉन्फ़िगर किया जा सकता है।"; +"Back" = "वापस"; +"Continue" = "जारी रखें"; + +// Appearance Tab +"Panel Theme" = "प्रकटन"; diff --git a/Clocker/Onboarding/FinalOnboardingViewController.swift b/Clocker/Onboarding/FinalOnboardingViewController.swift index f985511..7ab337f 100644 --- a/Clocker/Onboarding/FinalOnboardingViewController.swift +++ b/Clocker/Onboarding/FinalOnboardingViewController.swift @@ -8,6 +8,7 @@ struct EmailSignupConstants { static let CLOperatingSystemVersion = "OS" static let CLClockerVersion = "Clocker version" static let CLAppFeedbackDateProperty = "date" + static let CLAppLanguageKey = "Language" } class FinalOnboardingViewController: NSViewController { @@ -77,6 +78,7 @@ class FinalOnboardingViewController: NSViewController { EmailSignupConstants.CLOperatingSystemVersion: osVersion, EmailSignupConstants.CLClockerVersion: versionInfo, EmailSignupConstants.CLAppFeedbackDateProperty: todaysDate(), + EmailSignupConstants.CLAppLanguageKey: Locale.preferredLanguages.first ?? "en-US", ] } diff --git a/Clocker/Onboarding/Onboarding.storyboard b/Clocker/Onboarding/Onboarding.storyboard index ed9fdcd..2b96e41 100644 --- a/Clocker/Onboarding/Onboarding.storyboard +++ b/Clocker/Onboarding/Onboarding.storyboard @@ -1,7 +1,6 @@ - @@ -102,10 +101,10 @@ DQ - + - + @@ -465,7 +464,7 @@ DQ - + diff --git a/Clocker/Onboarding/OnboardingParentViewController.swift b/Clocker/Onboarding/OnboardingParentViewController.swift index 8f5edd9..654ce8d 100644 --- a/Clocker/Onboarding/OnboardingParentViewController.swift +++ b/Clocker/Onboarding/OnboardingParentViewController.swift @@ -27,7 +27,7 @@ class OnboardingParentViewController: NSViewController { private lazy var startupManager = StartupManager() - private lazy var welcomeVC = (storyboard?.instantiateController(withIdentifier: .welcomeIdentifier) as? WelcomeViewController) + private lazy var welcomeVC = (storyboard?.instantiateController(withIdentifier: .welcomeIdentifier) as? OnboardingWelcomeViewController) private lazy var permissionsVC = (storyboard?.instantiateController(withIdentifier: .onboardingPermissionsIdentifier) as? OnboardingPermissionsViewController) @@ -61,7 +61,10 @@ class OnboardingParentViewController: NSViewController { private func setupUI() { setIdentifiersForTests() - positiveButton.title = "Get Started" + positiveButton.title = NSLocalizedString("Get Started", + comment: "Title for Welcome View Controller's Continue Button") + backButton.title = NSLocalizedString("Back", + comment: "Button title for going back to the previous screen") positiveButton.tag = OnboardingType.welcome.rawValue backButton.tag = OnboardingType.welcome.rawValue @@ -89,7 +92,8 @@ class OnboardingParentViewController: NSViewController { options: .slideLeft) { self.positiveButton.tag = OnboardingType.search.rawValue self.backButton.tag = OnboardingType.launchAtLogin.rawValue - self.positiveButton.title = "Continue" + self.positiveButton.title = NSLocalizedString("Continue", + comment: "Continue Button Title") self.negativeButton.isHidden = true } } @@ -120,7 +124,8 @@ class OnboardingParentViewController: NSViewController { to: toViewController, options: .slideLeft) { self.positiveButton.tag = OnboardingType.permissions.rawValue - self.positiveButton.title = "Continue" + self.positiveButton.title = NSLocalizedString("Continue", + comment: "Continue Button Title") self.backButton.isHidden = false } } @@ -158,7 +163,8 @@ class OnboardingParentViewController: NSViewController { options: .slideLeft) { self.backButton.tag = OnboardingType.launchAtLogin.rawValue self.positiveButton.tag = OnboardingType.search.rawValue - self.positiveButton.title = "Continue" + self.positiveButton.title = NSLocalizedString("Continue", + comment: "Continue Button Title") self.negativeButton.isHidden = true } } @@ -225,7 +231,8 @@ class OnboardingParentViewController: NSViewController { options: .slideRight) { self.positiveButton.tag = OnboardingType.search.rawValue self.backButton.tag = OnboardingType.launchAtLogin.rawValue - self.positiveButton.title = "Continue" + self.positiveButton.title = NSLocalizedString("Continue", + comment: "Continue Button Title") self.negativeButton.isHidden = true } } @@ -260,7 +267,8 @@ class OnboardingParentViewController: NSViewController { self.positiveButton.tag = OnboardingType.permissions.rawValue self.backButton.tag = OnboardingType.welcome.rawValue self.negativeButton.isHidden = true - self.positiveButton.title = "Continue" + self.positiveButton.title = NSLocalizedString("Continue", + comment: "Continue Button Title") } } @@ -275,7 +283,8 @@ class OnboardingParentViewController: NSViewController { options: .slideRight) { self.positiveButton.tag = OnboardingType.welcome.rawValue self.backButton.isHidden = true - self.positiveButton.title = "Get Started" + self.positiveButton.title = NSLocalizedString("Get Started", + comment: "Title for Welcome View Controller's Continue Button") } } diff --git a/Clocker/Onboarding/OnboardingPermissionsViewController.swift b/Clocker/Onboarding/OnboardingPermissionsViewController.swift index ece0bca..b59d760 100644 --- a/Clocker/Onboarding/OnboardingPermissionsViewController.swift +++ b/Clocker/Onboarding/OnboardingPermissionsViewController.swift @@ -35,13 +35,17 @@ class OnboardingPermissionsViewController: NSViewController { } private func setup() { - appLabel.stringValue = "Permissions" - onboardingTypeLabel.stringValue = "These can be configured later in System Preferences." + appLabel.stringValue = NSLocalizedString("Permissions Tab", + comment: "Title for Permissions screen") + onboardingTypeLabel.stringValue = NSLocalizedString("Later Config Description", + comment: "Describing we can change the options later in System Preferences") - reminderHeaderLabel.stringValue = "Reminders Access" + reminderHeaderLabel.stringValue = NSLocalizedString("Reminders Access Title", + comment: "Title for Reminders Access Label") reminderDetailLabel.stringValue = "Set reminders in the timezone of the location of your choice. Your reminders are stored in the default Reminders app. " - calendarHeaderLabel.stringValue = "Calendar Access" + calendarHeaderLabel.stringValue = NSLocalizedString("Calendar Access Title", + comment: "Title for Calendar access label") calendarDetailLabel.stringValue = "Upcoming events from your personal and shared calendars can be shown in the menubar and the panel." privacyLabel.stringValue = CLEmptyString diff --git a/Clocker/Onboarding/OnboardingWelcomeViewController.swift b/Clocker/Onboarding/OnboardingWelcomeViewController.swift new file mode 100644 index 0000000..5036042 --- /dev/null +++ b/Clocker/Onboarding/OnboardingWelcomeViewController.swift @@ -0,0 +1,22 @@ +// Copyright © 2015 Abhishek Banthia + +import Cocoa + +class OnboardingWelcomeViewController: NSViewController { + @IBOutlet var appLabel: NSTextField! + @IBOutlet var accessoryLabel: NSTextField! + + override func viewDidLoad() { + super.viewDidLoad() + setup() + } + + private func setup() { + appLabel.stringValue = NSLocalizedString("CFBundleDisplayName", + comment: "App Name") + accessoryLabel.stringValue = NSLocalizedString("It only takes 3 steps to set up Clocker.", + comment: "App Setup Description") + + [appLabel, accessoryLabel].forEach { $0?.textColor = Themer.shared().mainTextColor() } + } +} diff --git a/Clocker/Onboarding/StartAtLoginViewController.swift b/Clocker/Onboarding/StartAtLoginViewController.swift index 9c45b32..f61d954 100644 --- a/Clocker/Onboarding/StartAtLoginViewController.swift +++ b/Clocker/Onboarding/StartAtLoginViewController.swift @@ -17,6 +17,7 @@ class StartAtLoginViewController: NSViewController { appName.stringValue = "Launch at Login" onboardingType.stringValue = "This can be configured later in Clocker Preferences." + // स्टार्टअप पर स्वचालित रूप से ऐप खोलना चाहिए accessoryLabel.stringValue = "Should Clocker open automatically on startup?" privacyLabel.stringValue = " " diff --git a/Clocker/Onboarding/WelcomeView.xib b/Clocker/Onboarding/WelcomeView.xib index 73bfc9b..386d4b8 100644 --- a/Clocker/Onboarding/WelcomeView.xib +++ b/Clocker/Onboarding/WelcomeView.xib @@ -1,12 +1,11 @@ - + - - + - + diff --git a/Clocker/Onboarding/WelcomeViewController.swift b/Clocker/Onboarding/WelcomeViewController.swift deleted file mode 100644 index 2932394..0000000 --- a/Clocker/Onboarding/WelcomeViewController.swift +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright © 2015 Abhishek Banthia - -import Cocoa - -class WelcomeViewController: NSViewController { - @IBOutlet var appLabel: NSTextField! - @IBOutlet var accessoryLabel: NSTextField! - - override func viewDidLoad() { - super.viewDidLoad() - setup() - } - - private func setup() { - appLabel.stringValue = "Clocker" - accessoryLabel.stringValue = "It only takes 3 steps to set up Clocker." - - [appLabel, accessoryLabel].forEach { $0?.textColor = Themer.shared().mainTextColor() } - } -}