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"; "Granted Button Text" = "Granted";
"Denied Button Text" = "Denied"; "Denied Button Text" = "Denied";
"Grant Button Text" = "Grant"; "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"; "Start at Login" = "Start Clocker at Login";
"Selected Timezones" = "Selected Timezones"; "Selected Timezones" = "Selected Timezones";
"Sort by Time Difference" = "Sort by Time Difference"; "Sort by Time Difference" = "Sort by Time Difference";
"Sort by Name" = "Sort by Name"; "Sort by Name" = "Sort by Name";
"Sort by Label" = "Sort by Label"; "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" = "सत"; "Granted Button Text" = "सत";
"Denied Button Text" = "इनकर कि"; "Denied Button Text" = "इनकर कि";
"Grant Button Text" = "अनन"; "Grant Button Text" = "अनन";
// Tab Item Titles
"Preferences Tab" = "पिज";
"Appearance Tab" = "दिवट";
"Calendar Tab" = "कडर";
"About Tab" = "अबउट";
"Permissions Tab" = "अनमति";
// General Preferencess
"Start at Login" = "लिन पर श कर"; "Start 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" = "ऐड ";
"Close Button Title" = "बद कर";

41
Clocker/Preferences/General/PreferencesViewController.swift

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

13
Clocker/Preferences/OneWindowController.swift

@ -15,9 +15,20 @@ class CenteredTabViewController: NSTabViewController {
} }
toolbarItems.append(NSToolbarItem.Identifier.flexibleSpace) toolbarItems.append(NSToolbarItem.Identifier.flexibleSpace)
return toolbarItems 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 { class OneWindowController: NSWindowController {

11
Clocker/Preferences/Preferences.storyboard

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

Loading…
Cancel
Save