Browse Source

Localization!

pull/92/head
Abhishek 5 years ago
parent
commit
4e5c7ce37a
  1. 93
      Clocker/Clocker/en.lproj/Localizable.strings
  2. 8
      Clocker/Onboarding/FinalOnboardingViewController.swift
  3. 6
      Clocker/Onboarding/OnboardingParentViewController.swift
  4. 30
      Clocker/Onboarding/OnboardingPermissionsViewController.swift
  5. 9
      Clocker/Onboarding/OnboardingSearchController.swift
  6. 6
      Clocker/Onboarding/StartAtLoginViewController.swift
  7. 6
      Clocker/Overall App/AppDefaults.swift
  8. 4
      Clocker/Panel/Notes Popover/NotesPopover.swift
  9. 9
      Clocker/Panel/ParentPanelController.swift
  10. 6
      Clocker/Panel/UI/NoTimezoneView.swift
  11. 2
      Clocker/Preferences/About/AboutViewController.swift
  12. 6
      Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift
  13. 31
      Clocker/Preferences/Appearance/AppearanceViewController.swift
  14. 24
      Clocker/Preferences/Calendar/CalendarViewController.swift
  15. 6
      Clocker/Preferences/General/PreferencesViewController.swift
  16. 4
      Clocker/Preferences/Permissions/PermissionsViewController.swift

93
Clocker/Clocker/en.lproj/Localizable.strings

@ -56,3 +56,96 @@
"Add Button Title" = "Add";
"Close Button Title" = "Close";
// Onboarding
"Open Clocker At Login" = "Open Clocker At Login";
"Launch Clocker" = "Launch Clocker";
// Welcome Onboarding
"It only takes 3 steps to set up Clocker." = "It only takes 3 steps to setup Clocker.";
"Get Started" = "Get Started";
// Permissions
"Calendar Access Title" = "Calendar Access";
"Reminders Access Title" = "Reminders Access";
"Later Config Description" = "These can be configured later in System Preferences.";
"Back" = "Back";
"Continue" = "Continue";
"Clocker is more useful when it can display events from your calendars." = "Clocker is more useful when it can display events from your calendars.";
"Clocker is more useful when it can display events from your calendars. You can change this setting in System Preferences › Security & Privacy › Privacy." = "Clocker is more useful when it can display events from your calendars. You can change this setting in System Preferences › Security & Privacy › Privacy.";
"Launch Preferences" = "Launch Preferences";
"Grant Access" = "Grant Access";
"Upcoming events from your personal and shared calendars can be shown in the menubar and the panel." = "Upcoming events from your personal and shared calendars can be shown in the menubar and the panel.";
"Granted" = "Granted";
"Denied" = "Denied";
"Grant" = "Grant";
"Unexpected" = "Unexpected";
// Onboarding Search
"Quick Add Locations" = "Quick Add Locations";
"More search options in Clocker Preferences." = "More search options in Clocker Preferences.";
"Search Locations" = "Search Locations";
// Start at Login
"Launch at Login" = "Launch at Login";
"This can be configured later in Clocker Preferences." = "This can be configured later in Clocker Preferences.";
"Should Clocker open automatically on startup?" = "Should Clocker open automatically on startup?";
// Final Onboarding Screen
"You're all set!" = "You're all set!";
"Thank you for the details." = "Thank you for the details.";
"You'll see a clock icon in your Menu Bar when you launch the app. If you'd like to see a dock icon, go to Preferences." = "You'll see a clock icon in your Menu Bar when you launch the app. If you'd like to see a dock icon, go to Preferences.";
"If you'd like to help us localize the app in your language or receive infrequent app-related updates, please enter your email!" = "If you'd like to help us localize the app in your language or receive infrequent app-related updates, please enter your email!";
// Appearance Tab
"Panel Theme" = "Panel Theme";
"Favourite a timezone to enable menubar display options." = "Favourite a timezone to enable menubar display options.";
"Main Panel Options" = "Main Panel Options";
"Time Format" = "Time Format";
"Day Display Options" = "Day Display Options";
"Show Future Slider" = "Show Future Slider";
"Show Sunrise/Sunset" = "Show Sunrise/Sunset";
"Display the time in seconds" = "Display the time in seconds";
"Larger Text" = "Larger Text";
"Future Slider Range" = "Future Slider Range";
"Include Date" = "Include Date";
"Include Day" = "Include Day";
"Include Place Name" = "Include Place Name";
"Menubar Display Options" = "Menubar Display Options";
"Menubar Mode" = "Menubar Mode";
// Empty View
"No places added" = "No places added";
// Panel
"No upcoming event." = "No upcoming event.";
"You have no events scheduled for tomorrow." = "You have no events scheduled for tomorrow.";
// Review
"Enjoy using Clocker?" = "Enjoy using Clocker?";
// App Feedback
"Tell us what you think!" = "Tell us what you think!";
"Contact Information (Optional)" = "Contact Information (Optional)";
"Contact fields are optional! Your contact information will let us contact you in case we need more information or can help!" = "Contact fields are optional! Your contact information will let us contact you in case we need more information or can help!";
// About View Screen
"Feedback is always welcome:" = "Feedback is always welcome:";
// Calendars View
"Upcoming Event View Options" = "Upcoming Event View Options";
"Show Upcoming Event View" = "Show Upcoming Event View";
"Show All Day Meetings" = "Show All Day Meetings";
"Show Next Meeting Title in Menubar" = "Show Next Meeting Title in Menubar";
"Truncate menubar text longer than" = "Truncate menubar text longer than";
"characters" = "characters";
"Show events from" = "Show events from";
"If meeting title is \"Meeting with Neel\" and truncate length is set to 5, text in menubar will appear as \"Meeti...\"" = "If meeting title is \"Meeting with Neel\" and truncate length is set to 5, text in menubar will appear as \"Meeti...\"";
// Notes Popover
"Reminder Set" = "Reminder Set";
"Successfully set." = "Successfully set.";
// Errors
"You're offline, maybe?" = "You're offline, maybe?";
"Try again, maybe?" = "Try again, maybe?";
"The Internet connection appears to be offline." = "The Internet connection appears to be offline.";

8
Clocker/Onboarding/FinalOnboardingViewController.swift

@ -39,11 +39,11 @@ class FinalOnboardingViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
titleLabel.stringValue = "You're all set!"
subtitleLabel.stringValue = "Thank you for the details."
accesoryLabel.stringValue = "You'll see a clock icon in your Menu Bar when you launch the app. If you'd like to see a dock icon, go to Preferences."
titleLabel.stringValue = "You're all set!".localized()
subtitleLabel.stringValue = "Thank you for the details.".localized()
accesoryLabel.stringValue = "You'll see a clock icon in your Menu Bar when you launch the app. If you'd like to see a dock icon, go to Preferences.".localized()
accessoryImageView.image = Themer.shared().menubarOnboardingImage()
emailExplanationLabel.stringValue = "If you'd like to help us localize the app in your language or receive infrequent app-related updates, please enter your email!"
emailExplanationLabel.stringValue = "If you'd like to help us localize the app in your language or receive infrequent app-related updates, please enter your email!".localized()
}
override func viewWillAppear() {

6
Clocker/Onboarding/OnboardingParentViewController.swift

@ -143,7 +143,7 @@ class OnboardingParentViewController: NSViewController {
options: .slideLeft) {
self.backButton.tag = OnboardingType.permissions.rawValue
self.positiveButton.tag = OnboardingType.launchAtLogin.rawValue
self.positiveButton.title = "Open Clocker At Login"
self.positiveButton.title = "Open Clocker At Login".localized()
self.negativeButton.isHidden = false
}
}
@ -182,7 +182,7 @@ class OnboardingParentViewController: NSViewController {
options: .slideLeft) {
self.backButton.tag = OnboardingType.search.rawValue
self.positiveButton.tag = OnboardingType.final.rawValue
self.positiveButton.title = "Launch Clocker"
self.positiveButton.title = "Launch Clocker".localized()
}
}
@ -248,7 +248,7 @@ class OnboardingParentViewController: NSViewController {
options: .slideRight) {
self.positiveButton.tag = OnboardingType.launchAtLogin.rawValue
self.backButton.tag = OnboardingType.permissions.rawValue
self.positiveButton.title = "Open Clocker At Login"
self.positiveButton.title = "Open Clocker At Login".localized()
self.negativeButton.isHidden = false
}
}

30
Clocker/Onboarding/OnboardingPermissionsViewController.swift

@ -46,7 +46,7 @@ class OnboardingPermissionsViewController: NSViewController {
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."
calendarDetailLabel.stringValue = "Upcoming events from your personal and shared calendars can be shown in the menubar and the panel.".localized()
privacyLabel.stringValue = CLEmptyString
@ -67,23 +67,23 @@ class OnboardingPermissionsViewController: NSViewController {
} */
if EventCenter.sharedCenter().calendarAccessGranted() {
calendarGrantButton.title = "Granted"
calendarGrantButton.title = "Granted".localized()
} else if EventCenter.sharedCenter().calendarAccessDenied() {
calendarGrantButton.title = "Denied"
calendarGrantButton.title = "Denied".localized()
} else if EventCenter.sharedCenter().calendarAccessNotDetermined() {
calendarGrantButton.title = "Grant"
calendarGrantButton.title = "Grant".localized()
} else {
calendarGrantButton.title = "Unexpected"
calendarGrantButton.title = "Unexpected".localized()
}
if EventCenter.sharedCenter().reminderAccessGranted() {
reminderGrantButton.title = "Granted"
reminderGrantButton.title = "Granted".localized()
} else if EventCenter.sharedCenter().reminderAccessDenied() {
reminderGrantButton.title = "Denied"
reminderGrantButton.title = "Denied".localized()
} else if EventCenter.sharedCenter().reminderAccessNotDetermined() {
reminderGrantButton.title = "Grant"
reminderGrantButton.title = "Grant".localized()
} else {
reminderGrantButton.title = "Unexpected"
reminderGrantButton.title = "Unexpected".localized()
}
}
@ -100,7 +100,7 @@ class OnboardingPermissionsViewController: NSViewController {
self.calendarActivityIndicator.stopAnimation(nil)
if granted {
self.calendarGrantButton.title = "Granted"
self.calendarGrantButton.title = "Granted".localized()
self.view.window?.orderBack(nil)
NSApp.activate(ignoringOtherApps: true)
@ -114,9 +114,9 @@ class OnboardingPermissionsViewController: NSViewController {
}
})
} else if eventCenter.calendarAccessGranted() {
calendarGrantButton.title = "Granted"
calendarGrantButton.title = "Granted".localized()
} else {
calendarGrantButton.title = "Denied"
calendarGrantButton.title = "Denied".localized()
}
}
@ -137,16 +137,16 @@ class OnboardingPermissionsViewController: NSViewController {
self.view.window?.orderBack(nil)
NSApp.activate(ignoringOtherApps: true)
self.reminderGrantButton.title = "Granted"
self.reminderGrantButton.title = "Granted".localized()
}
} else {
Logger.log(object: ["Reminder Access Not Granted": "YES"], for: "Reminder Access Not Granted")
}
})
} else if eventCenter.reminderAccessGranted() {
reminderGrantButton.title = "Granted"
reminderGrantButton.title = "Granted".localized()
} else {
reminderGrantButton.title = "Denied"
reminderGrantButton.title = "Denied".localized()
}
}
}

9
Clocker/Onboarding/OnboardingSearchController.swift

@ -180,7 +180,8 @@ class OnboardingSearchController: NSViewController {
self.accessoryLabel.stringValue = "Added \(filteredAddress)."
self.undoButton.isHidden = false
Logger.log(object: ["Place Name": filteredAddress], for: "Added Timezone while Onboarding")
Logger.log(object: ["Place Name": filteredAddress],
for: "Added Timezone while Onboarding")
}
// Cleanup.
@ -207,10 +208,10 @@ class OnboardingSearchController: NSViewController {
"Sydney NSW", "Berlin"]
private func setup() {
appName.stringValue = "Quick Add Locations"
onboardingTypeLabel.stringValue = "More search options in Clocker Preferences."
appName.stringValue = "Quick Add Locations".localized()
onboardingTypeLabel.stringValue = "More search options in Clocker Preferences.".localized()
setInfoLabel(CLEmptyString)
searchBar.placeholderString = "Search Locations"
searchBar.placeholderString = "Search Locations".localized()
resultsTableView.backgroundColor = Themer.shared().mainBackgroundColor()
resultsTableView.enclosingScrollView?.backgroundColor = Themer.shared().mainBackgroundColor()

6
Clocker/Onboarding/StartAtLoginViewController.swift

@ -14,11 +14,11 @@ class StartAtLoginViewController: NSViewController {
}
private func setup() {
appName.stringValue = "Launch at Login"
onboardingType.stringValue = "This can be configured later in Clocker Preferences."
appName.stringValue = "Launch at Login".localized()
onboardingType.stringValue = "This can be configured later in Clocker Preferences.".localized()
// ि ि
accessoryLabel.stringValue = "Should Clocker open automatically on startup?"
accessoryLabel.stringValue = "Should Clocker open automatically on startup?".localized()
privacyLabel.stringValue = " "
[privacyLabel, accessoryLabel, onboardingType, appName].forEach { $0?.textColor = Themer.shared().mainTextColor() }

6
Clocker/Overall App/AppDefaults.swift

@ -135,6 +135,12 @@ class AppDefaults {
}
}
extension String {
func localized() -> String {
return NSLocalizedString(self, comment: "Title for \(self)")
}
}
extension UserDefaults {
// Use this with caution. Exposing this for debugging purposes only.
func wipe() {

4
Clocker/Panel/Notes Popover/NotesPopover.swift

@ -422,8 +422,8 @@ class NotesPopover: NSViewController {
private func showSuccessMessage() {
let reminderNotification = NSUserNotification()
reminderNotification.title = "Reminder Set"
reminderNotification.subtitle = "Successfully set."
reminderNotification.title = "Reminder Set".localized()
reminderNotification.subtitle = "Successfully set.".localized()
NSUserNotificationCenter.default.scheduleNotification(reminderNotification)
}

9
Clocker/Panel/ParentPanelController.swift

@ -788,7 +788,8 @@ class ParentPanelController: NSWindowController {
return
}
nextEventLabel.stringValue = "No upcoming event."
nextEventLabel.stringValue = NSLocalizedString("No upcoming event.",
comment: "Title when there's no upcoming event")
calendarColorView.layer?.backgroundColor = NSColor(red: 97 / 255.0, green: 194 / 255.0, blue: 80 / 255.0, alpha: 1.0).cgColor
let events = eventCenter.filteredEvents[NSCalendar.autoupdatingCurrent.startOfDay(for: tomorrowDate)]
@ -799,7 +800,8 @@ class ParentPanelController: NSWindowController {
} else if let first = events?.first?.event.title {
setCalendarButtonTitle(buttonTitle: "\(first) coming up.")
} else {
setCalendarButtonTitle(buttonTitle: "You have no events scheduled for tomorrow.")
setCalendarButtonTitle(buttonTitle: NSLocalizedString("You have no events scheduled for tomorrow.",
comment: "Title when there's no event scheduled for tomorrow"))
}
}
@ -856,7 +858,8 @@ class ParentPanelController: NSWindowController {
private func updateReviewView() {
reviewView.isHidden = true
showReviewCell = false
leftField.stringValue = "Enjoy using Clocker?"
leftField.stringValue = NSLocalizedString("Enjoy using Clocker",
comment: "Title asking users if they like the app")
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = .center

6
Clocker/Panel/UI/NoTimezoneView.swift

@ -28,8 +28,10 @@ class NoTimezoneView: NSView {
height: 200))
messageField.wantsLayer = true
messageField.setAccessibilityIdentifier("NoTimezoneMessage")
messageField.placeholderString = "No places added"
messageField.stringValue = "No places added"
messageField.placeholderString = NSLocalizedString("No places added",
comment: "Subtitle for no places added")
messageField.stringValue = NSLocalizedString("No places added",
comment: "Subtitle for no places added")
messageField.isBordered = false
messageField.isEditable = false
messageField.maximumNumberOfLines = 2

2
Clocker/Preferences/About/AboutViewController.swift

@ -140,7 +140,7 @@ class AboutViewController: ParentViewController {
@IBOutlet var feedbackLabel: NSTextField!
private func setup() {
feedbackLabel.stringValue = "Feedback is always welcome:"
feedbackLabel.stringValue = "Feedback is always welcome:".localized()
feedbackLabel.textColor = Themer.shared().mainTextColor()
versionField.textColor = Themer.shared().mainTextColor()
underlineTextForActionButton()

6
Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift

@ -209,9 +209,9 @@ class AppFeedbackWindowController: NSWindowController {
@IBOutlet var accessoryInfo: NSTextField!
private func setup() {
headerLabel.stringValue = "Tell us what you think!"
contactBox.title = "Contact Information (Optional)"
accessoryInfo.stringValue = "Contact fields are optional! Your contact information will let us contact you in case we need more information or can help!"
headerLabel.stringValue = "Tell us what you think!".localized()
contactBox.title = "Contact Information (Optional)".localized()
accessoryInfo.stringValue = "Contact fields are optional! Your contact information will let us contact you in case we need more information or can help!".localized()
[headerLabel, accessoryInfo].forEach { $0?.textColor = Themer.shared().mainTextColor() }

31
Clocker/Preferences/Appearance/AppearanceViewController.swift

@ -18,7 +18,7 @@ class AppearanceViewController: ParentViewController {
override func viewDidLoad() {
super.viewDidLoad()
informationLabel.stringValue = "Favourite a timezone to enable menubar display options."
informationLabel.stringValue = "Favourite a timezone to enable menubar display options.".localized()
informationLabel.textColor = NSColor.secondaryLabelColor
informationLabel.setAccessibilityIdentifier("InformationLabel")
@ -97,21 +97,20 @@ class AppearanceViewController: ParentViewController {
@IBOutlet var menubarModeLabel: NSTextField!
private func setup() {
headerLabel.stringValue = "Main Panel Options"
timeFormatLabel.stringValue = "Time Format"
panelTheme.stringValue = NSLocalizedString("Panel Theme",
comment: "String for theme")
dayDisplayOptionsLabel.stringValue = "Day Display Options"
showSliderLabel.stringValue = "Show Future Slider"
showSunriseLabel.stringValue = "Show Sunrise/Sunset"
showSecondsLabel.stringValue = "Display the time in seconds"
largerTextLabel.stringValue = "Larger Text"
futureSliderRangeLabel.stringValue = "Future Slider Range"
includeDateLabel.stringValue = "Include Date"
includeDayLabel.stringValue = "Include Day"
includePlaceLabel.stringValue = "Include Place Name"
menubarDisplayOptionsLabel.stringValue = "Menubar Display Options"
menubarModeLabel.stringValue = "Menubar Mode"
headerLabel.stringValue = "Main Panel Options".localized()
timeFormatLabel.stringValue = "Time Format".localized()
panelTheme.stringValue = "Panel Theme".localized()
dayDisplayOptionsLabel.stringValue = "Day Display Options".localized()
showSliderLabel.stringValue = "Show Future Slider".localized()
showSunriseLabel.stringValue = "Show Sunrise/Sunset".localized()
showSecondsLabel.stringValue = "Display the time in seconds".localized()
largerTextLabel.stringValue = "Larger Text".localized()
futureSliderRangeLabel.stringValue = "Future Slider Range".localized()
includeDateLabel.stringValue = "Include Date".localized()
includeDayLabel.stringValue = "Include Day".localized()
includePlaceLabel.stringValue = "Include Place Name".localized()
menubarDisplayOptionsLabel.stringValue = "Menubar Display Options".localized()
menubarModeLabel.stringValue = "Menubar Mode".localized()
[headerLabel, timeFormatLabel, panelTheme,
dayDisplayOptionsLabel, showSliderLabel, showSecondsLabel,

24
Clocker/Preferences/Calendar/CalendarViewController.swift

@ -100,8 +100,8 @@ class CalendarViewController: ParentViewController {
noAccessView.isHidden = hasCalendarAccess
if hasNotDeterminedCalendarAccess {
informationField.stringValue = "Clocker is more useful when it can display events from your calendars."
setGrantAccess(title: "Grant Access")
informationField.stringValue = "Clocker is more useful when it can display events from your calendars.".localized()
setGrantAccess(title: "Grant Access".localized())
} else if hasDeniedCalendarAccess {
// The informationField text is taken care off in the XIB. Just set the grant button to empty because we can't do anything.
setGrantAccess(title: CLEmptyString)
@ -127,8 +127,8 @@ class CalendarViewController: ParentViewController {
}
private func onCalendarAccessDenial() {
informationField.stringValue = "Clocker is more useful when it can display events from your calendars. You can change this setting in System Preferences › Security & Privacy › Privacy."
setGrantAccess(title: "Launch Preferences")
informationField.stringValue = "Clocker is more useful when it can display events from your calendars. You can change this setting in System Preferences › Security & Privacy › Privacy.".localized()
setGrantAccess(title: "Launch Preferences".localized())
// Remove upcoming event view if possible
UserDefaults.standard.set("NO", forKey: CLShowUpcomingEventView)
@ -209,14 +209,14 @@ class CalendarViewController: ParentViewController {
private func setup() {
// Grant access button's text color is taken care above.
headerLabel.stringValue = "Upcoming Event View Options"
upcomingEventView.stringValue = "Show Upcoming Event View"
allDayMeetingsLabel.stringValue = "Show All Day Meetings"
showNextMeetingLabel.stringValue = "Show Next Meeting Title in Menubar"
truncateTextLabel.stringValue = "Truncate menubar text longer than"
charactersField.stringValue = "characters"
showEventsFromLabel.stringValue = "Show events from"
truncateAccessoryLabel.stringValue = "If meeting title is \"Meeting with Neel\" and truncate length is set to 5, text in menubar will appear as \"Meeti...\""
headerLabel.stringValue = "Upcoming Event View Options".localized()
upcomingEventView.stringValue = "Show Upcoming Event View".localized()
allDayMeetingsLabel.stringValue = "Show All Day Meetings".localized()
showNextMeetingLabel.stringValue = "Show Next Meeting Title in Menubar".localized()
truncateTextLabel.stringValue = "Truncate menubar text longer than".localized()
charactersField.stringValue = "characters".localized()
showEventsFromLabel.stringValue = "Show events from".localized()
truncateAccessoryLabel.stringValue = "If meeting title is \"Meeting with Neel\" and truncate length is set to 5, text in menubar will appear as \"Meeti...\"".localized()
[headerLabel, upcomingEventView, allDayMeetingsLabel,
showNextMeetingLabel, nextMeetingAccessoryLabel, truncateTextLabel,

6
Clocker/Preferences/General/PreferencesViewController.swift

@ -9,9 +9,9 @@ struct PreferencesConstants {
comment: "Max Timezones Error Message")
static let maxCharactersAllowed = NSLocalizedString("Max Search Characters",
comment: "Max Character Count Allowed Error Message")
static let noInternetConnectivityError = "You're offline, maybe?"
static let tryAgainMessage = "Try again, maybe?"
static let offlineErrorMessage = "The Internet connection appears to be offline."
static let noInternetConnectivityError = "You're offline, maybe?".localized()
static let tryAgainMessage = "Try again, maybe?".localized()
static let offlineErrorMessage = "The Internet connection appears to be offline.".localized()
static let hotKeyPathIdentifier = "values.globalPing"
}

4
Clocker/Preferences/Permissions/PermissionsViewController.swift

@ -90,7 +90,7 @@ class PermissionsViewController: ParentViewController {
calendarButton.title = NSLocalizedString("Grant Button Text",
comment: "Grant Button Text")
} else {
calendarButton.title = "Unexpected"
calendarButton.title = "Unexpected".localized()
}
if EventCenter.sharedCenter().reminderAccessGranted() {
@ -103,7 +103,7 @@ class PermissionsViewController: ParentViewController {
remindersButton.title = NSLocalizedString("Grant Button Text",
comment: "Grant Button Text")
} else {
remindersButton.title = "Unexpected"
remindersButton.title = "Unexpected".localized()
}
}

Loading…
Cancel
Save