Browse Source

Tab title localization!

pull/92/head
Abhishek 5 years ago
parent
commit
1ae5e405db
  1. 16
      Clocker/Clocker/en.lproj/Localizable.strings
  2. 15
      Clocker/Clocker/hi.lproj/Localizable.strings
  3. 41
      Clocker/Preferences/General/PreferencesViewController.swift
  4. 13
      Clocker/Preferences/OneWindowController.swift
  5. 11
      Clocker/Preferences/Preferences.storyboard

16
Clocker/Clocker/en.lproj/Localizable.strings

@ -31,8 +31,24 @@
"Granted Button Text" = "Granted";
"Denied Button Text" = "Denied";
"Grant Button Text" = "Grant";
// Tab Item Titles
"Preferences Tab" = "Preferences";
"Appearance Tab" = "Appearance";
"Calendar Tab" = "Calendar";
"About Tab" = "About";
"Permissions Tab" = "Permissions";
// General Preferences Screen
"Start at Login" = "Start Clocker at Login";
"Selected Timezones" = "Selected Timezones";
"Sort by Time Difference" = "Sort by Time Difference";
"Sort by Name" = "Sort by Name";
"Sort by Label" = "Sort by Label";
"Search Field Placeholder" = "Enter a city, state or country name";
"No Timezone Selected Error Message" = "Please select a timezone!";
"Max Timezones Selected Error Message" = "Maximum 100 timezones allowed!";
"Max Search Characters Error Message" = "Only 50 characters allowed!";
"Add Button Title" = "Add";
"Close Button Title" = "Close";

15
Clocker/Clocker/hi.lproj/Localizable.strings

@ -31,8 +31,23 @@
"Granted Button Text" = "सत";
"Denied Button Text" = "इनकर कि";
"Grant Button Text" = "अनन";
// Tab Item Titles
"Preferences Tab" = "पिज";
"Appearance Tab" = "दिवट";
"Calendar Tab" = "कडर";
"About Tab" = "अबउट";
"Permissions Tab" = "अनमति";
// General Preferencess
"Start at Login" = "लिन पर श कर";
"Selected Timezones" = "चयनित सन";
"Sort by Time Difference" = "समय अतर दट कर";
"Sort by Name" = "नम दट कर";
"Sort by Label" = "लबल दट कर";
"Search Field Placeholder" = "Enter a city, state or country name";
"No Timezone Selected Error Message" = "Please select a timezone!";
"Max Timezones Selected Error Message" = "Maximum 100 timezones allowed!";
"Max Search Characters Error Message" = "Only 50 characters allowed!";
"Add Button Title" = "ऐड ";
"Close Button Title" = "बद कर";

41
Clocker/Preferences/General/PreferencesViewController.swift

@ -3,9 +3,12 @@
import Cocoa
struct PreferencesConstants {
static let noTimezoneSelectedErrorMessage = "Please select a timezone!"
static let maxTimezonesErrorMessage = "Maximum 100 timezones allowed!"
static let maxCharactersAllowed = "Only 50 characters allowed!"
static let noTimezoneSelectedErrorMessage = NSLocalizedString("No Timezone Selected",
comment: "Message shown when the user taps on Add without selecting a timezone")
static let maxTimezonesErrorMessage = NSLocalizedString("Max Timezones Selected",
comment: "Max Timezones Error Message")
static let maxCharactersAllowed = NSLocalizedString("Max Search Characters Error Message",
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."
@ -48,6 +51,7 @@ class PreferencesViewController: ParentViewController {
@IBOutlet private var progressIndicator: NSProgressIndicator!
@IBOutlet private var addButton: NSButton!
@IBOutlet private var recorderControl: SRRecorderControl!
@IBOutlet private var closeButton: NSButton!
@IBOutlet private var timezoneSortButton: NSButton!
@IBOutlet private var timezoneNameSortButton: NSButton!
@ -122,11 +126,20 @@ class PreferencesViewController: ParentViewController {
}
private func setupLocalizedText() {
startAtLoginLabel.stringValue = NSLocalizedString("Start at Login", comment: "Start at Login")
headerLabel.stringValue = NSLocalizedString("Selected Timezones", comment: "Start at Login")
timezoneSortButton.title = NSLocalizedString("Sort by Time Difference", comment: "Start at Login")
timezoneNameSortButton.title = NSLocalizedString("Sort by Name", comment: "Start at Login")
labelSortButton.title = NSLocalizedString("Sort by Label", comment: "Start at Login")
startAtLoginLabel.stringValue = NSLocalizedString("Start at Login",
comment: "Start at Login")
headerLabel.stringValue = NSLocalizedString("Selected Timezones",
comment: "Start at Login")
timezoneSortButton.title = NSLocalizedString("Sort by Time Difference",
comment: "Start at Login")
timezoneNameSortButton.title = NSLocalizedString("Sort by Name",
comment: "Start at Login")
labelSortButton.title = NSLocalizedString("Sort by Label",
comment: "Start at Login")
addButton.title = NSLocalizedString("Add Button Title",
comment: "Button to add a location")
closeButton.title = NSLocalizedString("Close Button Title",
comment: "Button to close the panel")
}
@objc func refreshTimezoneTableView() {
@ -694,7 +707,8 @@ extension PreferencesViewController {
private func setErrorPlaceholders() {
placeholderLabel.placeholderString = "No timezone found! Try entering an exact name."
searchField.placeholderString = "Enter a city, state or country name"
searchField.placeholderString = NSLocalizedString("Search Field Placeholder",
comment: "Search Field Placeholder")
isActivityInProgress = false
}
@ -705,7 +719,8 @@ extension PreferencesViewController {
refreshMainTable()
timezonePanel.close()
placeholderLabel.placeholderString = CLEmptyString
searchField.placeholderString = "Enter a city, state or country name"
searchField.placeholderString = NSLocalizedString("Search Field Placeholder",
comment: "Search Field Placeholder")
availableTimezoneTableView.isHidden = false
isActivityInProgress = false
}
@ -824,7 +839,8 @@ extension PreferencesViewController {
refreshMainTable()
timezonePanel.close()
searchField.placeholderString = "Enter a city, state or country name"
searchField.placeholderString = NSLocalizedString("Search Field Placeholder",
comment: "Search Field Placeholder")
availableTimezoneTableView.isHidden = false
isActivityInProgress = false
}
@ -844,7 +860,8 @@ extension PreferencesViewController {
searchResultsDataSource.timezoneFilteredArray = []
searchField.stringValue = CLEmptyString
placeholderLabel.placeholderString = CLEmptyString
searchField.placeholderString = "Enter a city, state or country name"
searchField.placeholderString = NSLocalizedString("Search Field Placeholder",
comment: "Search Field Placeholder")
reloadSearchResults()

13
Clocker/Preferences/OneWindowController.swift

@ -15,9 +15,20 @@ class CenteredTabViewController: NSTabViewController {
}
toolbarItems.append(NSToolbarItem.Identifier.flexibleSpace)
return toolbarItems
}
override func viewDidLoad() {
super.viewDidLoad()
// Setup localized tab labels
tabViewItems.forEach { item in
if let identifier = item.identifier as? String {
print(identifier)
item.label = NSLocalizedString(identifier, comment: "Tab View Item Label for \(identifier)")
}
}
}
}
class OneWindowController: NSWindowController {

11
Clocker/Preferences/Preferences.storyboard

@ -33,11 +33,11 @@
<objects>
<tabViewController selectedTabViewItemIndex="0" tabStyle="toolbar" id="SH5-GG-x4O" customClass="CenteredTabViewController" customModule="Clocker" customModuleProvider="target" sceneMemberID="viewController">
<tabViewItems>
<tabViewItem label="General" identifier="Preferences" image="NSPreferencesGeneral" id="KX2-eQ-kpC"/>
<tabViewItem label=" Appearance " identifier="Appearance" image="Appearance Dynamic" id="UFb-Xx-XzY"/>
<tabViewItem label=" Calendar " identifier="Calendar" image="Calendar Tab Dynamic" id="dtc-kZ-ICY"/>
<tabViewItem label=" Permissions " identifier="Permissions" image="Privacy" id="0LV-gD-HSJ" userLabel="Permissions"/>
<tabViewItem label=" About " identifier="AboutClocker" image="NSInfo" id="H6X-F4-LIW"/>
<tabViewItem label="General" identifier="Preferences Tab" image="NSPreferencesGeneral" id="KX2-eQ-kpC"/>
<tabViewItem label=" Appearance " identifier="Appearance Tab" image="Appearance Dynamic" id="UFb-Xx-XzY"/>
<tabViewItem label=" Calendar " identifier="Calendar Tab" image="Calendar Tab Dynamic" id="dtc-kZ-ICY"/>
<tabViewItem label=" Permissions " identifier="Permissions Tab" image="Privacy" id="0LV-gD-HSJ" userLabel="Permissions"/>
<tabViewItem label=" About " identifier="About Tab" image="NSInfo" id="H6X-F4-LIW"/>
</tabViewItems>
<viewControllerTransitionOptions key="transitionOptions" crossfade="YES" slideRight="YES" slideBackward="YES" allowUserInteraction="YES"/>
<tabView key="tabView" type="noTabsNoBorder" id="gdR-rH-VZM">
@ -1620,6 +1620,7 @@ CA
<outlet property="addTimezoneButton" destination="1FY-Nb-ZXb" id="mzu-MA-c0E"/>
<outlet property="additionalSortOptions" destination="J2K-hR-0jv" id="oXh-9H-RRO"/>
<outlet property="availableTimezoneTableView" destination="xkl-2X-ZCb" id="HPB-cB-egR"/>
<outlet property="closeButton" destination="woG-LO-TxX" id="Jwl-Cd-Fzd"/>
<outlet property="deleteButton" destination="48a-Zz-oQg" id="zEg-aT-Mzj"/>
<outlet property="headerLabel" destination="m5V-sS-Na7" id="l5h-Wa-dbC"/>
<outlet property="headerView" destination="YQR-N6-uZO" id="D71-8n-deV"/>

Loading…
Cancel
Save