Browse Source

Localization is a pain.

pull/92/head
Abhishek 5 years ago
parent
commit
6b54f8331c
  1. 8
      Clocker/Clocker.xcodeproj/project.pbxproj
  2. 4
      Clocker/Clocker/en.lproj/Localizable.strings
  3. 14
      Clocker/Clocker/hi.lproj/Localizable.strings
  4. 2
      Clocker/Onboarding/FinalOnboardingViewController.swift
  5. 7
      Clocker/Onboarding/Onboarding.storyboard
  6. 25
      Clocker/Onboarding/OnboardingParentViewController.swift
  7. 12
      Clocker/Onboarding/OnboardingPermissionsViewController.swift
  8. 22
      Clocker/Onboarding/OnboardingWelcomeViewController.swift
  9. 1
      Clocker/Onboarding/StartAtLoginViewController.swift
  10. 7
      Clocker/Onboarding/WelcomeView.xib
  11. 20
      Clocker/Onboarding/WelcomeViewController.swift

8
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 = "<group>"; };
35C36EE322595EFD002FA5C6 /* StatusItemHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusItemHandler.swift; sourceTree = "<group>"; };
35C36EE822595F13002FA5C6 /* OnboardingPermissionsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingPermissionsViewController.swift; sourceTree = "<group>"; };
35C36EE922595F13002FA5C6 /* WelcomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WelcomeViewController.swift; sourceTree = "<group>"; };
35C36EE922595F13002FA5C6 /* OnboardingWelcomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingWelcomeViewController.swift; sourceTree = "<group>"; };
35C36EEA22595F13002FA5C6 /* WelcomeView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = WelcomeView.xib; sourceTree = "<group>"; };
35C36EEB22595F13002FA5C6 /* StartAtLoginViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StartAtLoginViewController.swift; sourceTree = "<group>"; };
35C36EEC22595F13002FA5C6 /* OnboardingSearchController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingSearchController.swift; sourceTree = "<group>"; };
@ -741,7 +741,7 @@
35C36EEC22595F13002FA5C6 /* OnboardingSearchController.swift */,
35C36EEB22595F13002FA5C6 /* StartAtLoginViewController.swift */,
35C36EEA22595F13002FA5C6 /* WelcomeView.xib */,
35C36EE922595F13002FA5C6 /* WelcomeViewController.swift */,
35C36EE922595F13002FA5C6 /* OnboardingWelcomeViewController.swift */,
);
path = Onboarding;
sourceTree = "<group>";
@ -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 */,

4
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";

14
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" = "परकटन";

2
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",
]
}

7
Clocker/Onboarding/Onboarding.storyboard

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="fde-UX-327">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@ -102,10 +101,10 @@ DQ
</objects>
<point key="canvasLocation" x="814" y="175"/>
</scene>
<!--Welcome View Controller-->
<!--Onboarding Welcome View Controller-->
<scene sceneID="Xhh-wb-YNe">
<objects>
<viewController storyboardIdentifier="welcomeVC" id="AlZ-fA-HYH" customClass="WelcomeViewController" customModule="Clocker" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="welcomeVC" id="AlZ-fA-HYH" customClass="OnboardingWelcomeViewController" customModule="Clocker" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="65Q-Jl-OEb">
<rect key="frame" x="0.0" y="0.0" width="436" height="400"/>
<autoresizingMask key="autoresizingMask"/>
@ -465,7 +464,7 @@ DQ
<rect key="frame" x="20" y="49" width="396" height="160"/>
<clipView key="contentView" id="XpR-1t-AQy">
<rect key="frame" x="0.0" y="0.0" width="396" height="160"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="33" rowSizeStyle="automatic" viewBased="YES" id="30y-X6-i7I">
<rect key="frame" x="0.0" y="0.0" width="396" height="160"/>

25
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")
}
}

12
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

22
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() }
}
}

1
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 = " "

7
Clocker/Onboarding/WelcomeView.xib

@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.18"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="WelcomeViewController" customModule="Clocker" customModuleProvider="target">
<customObject id="-2" userLabel="File's Owner" customClass="OnboardingWelcomeViewController" customModule="Clocker" customModuleProvider="target">
<connections>
<outlet property="accessoryLabel" destination="Pvz-jw-4nJ" id="gCU-a9-uiz"/>
<outlet property="appLabel" destination="hla-i3-RpJ" id="wqd-xT-9Cw"/>

20
Clocker/Onboarding/WelcomeViewController.swift

@ -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() }
}
}
Loading…
Cancel
Save