Skip to content

Commit

Permalink
Add #194: Localisation issue fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mumthasir mohammed committed Jan 4, 2024
1 parent 52ac3ca commit df2af1d
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 55 deletions.
48 changes: 24 additions & 24 deletions PrivacyDashboardiOS/Classes/Constatnts/Constant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ struct Constant {
static let KPromptMsgNotConfigured = "Not Configured"

static let areYouSureYouWantToAllow = "Are you sure you want to allow?"
static let allow = "bb_consent_data_attribute_allow".localized
static let allow = "bb_consent_data_attribute_allow"
static let areYouSureYouWantToDisAllow = "Are you sure you want to disallow?"
static let disallow = "bb_consent_dashboard_disallow".localized
static let disallow = "bb_consent_dashboard_disallow"
static let areYouWantToDisallowAll = "Are you sure you want to disallow all ?"
static let disallowAll = "Disallow All"
static let invalidURL = "Invalid URL"

static let cancelRequest = "bb_consent_user_request_cancel_request".localized
static let cancelRequest = "bb_consent_user_request_cancel_request"
static let yourRequestCancelled = "Your request cancelled successfully"
static let OK = "OK"
static let cancel = "bb_consent_cancel".localized
static let cancel = "bb_consent_cancel"
static let doYouWantToCancelThisRequest = "Do you want to cancel this request?"
}

Expand Down Expand Up @@ -133,30 +133,30 @@ struct Constant {
}

struct Strings {
static let days = "bb_consent_data_attribute_detail_days_with_count".localized
static let consent = "bb_consent_data_attribute_detail_consent".localized
static let consentAllowedNoteOne = "bb_consent_data_attribute_detail_allow_consent_rule".localized
static let days = "bb_consent_data_attribute_detail_days_with_count"
static let consent = "bb_consent_data_attribute_detail_consent"
static let consentAllowedNoteOne = "bb_consent_data_attribute_detail_allow_consent_rule"
static let consentAllowedNoteTwo = " permanently for any analytics or third party usage beyond the purposes you have signed up with."
static let consentDisAllowedNote = "bb_consent_data_attribute_detail_disallow_consent_rule".localized
static let consentDefaultNote = "bb_consent_data_attribute_detail_askme_consent_rule".localized
static let cancel = "bb_consent_cancel".localized
static let privacyPolicy = "bb_consent_web_view_privacy_policy".localized
static let policy = "bb_consent_web_view_policy".localized
static let userRequests = "bb_consent_user_request_user_request".localized
static let consentHistory = "bb_consent_history_consent_history".localized
static let allow = "bb_consent_data_attribute_allow".localized
static let disallow = "bb_consent_dashboard_disallow".localized
static let consentDisAllowedNote = "bb_consent_data_attribute_detail_disallow_consent_rule"
static let consentDefaultNote = "bb_consent_data_attribute_detail_askme_consent_rule"
static let cancel = "bb_consent_cancel"
static let privacyPolicy = "bb_consent_web_view_privacy_policy"
static let policy = "bb_consent_web_view_policy"
static let userRequests = "bb_consent_user_request_user_request"
static let consentHistory = "bb_consent_history_consent_history"
static let allow = "bb_consent_data_attribute_allow"
static let disallow = "bb_consent_dashboard_disallow"
static let askMe = "AskMe"
static let noHistoryAbailable = "bb_consent_history_empty_consent_history".localized
static let downloadData = "bb_consent_user_request_download_data".localized
static let deleteData = "bb_consent_user_request_delete_data".localized
static let requestInitiated = "bb_consent_user_request_request_initiated".localized
static let requestAcknowledged = "bb_consent_user_request_request_acknowledged".localized
static let requestProcessed = "bb_consent_user_request_request_processed".localized
static let noHistoryAbailable = "bb_consent_history_empty_consent_history"
static let downloadData = "bb_consent_user_request_download_data"
static let deleteData = "bb_consent_user_request_delete_data"
static let requestInitiated = "bb_consent_user_request_request_initiated"
static let requestAcknowledged = "bb_consent_user_request_request_acknowledged"
static let requestProcessed = "bb_consent_user_request_request_processed"
static let downloadDataRequestStatus = "Download Data Request Status"
static let deleteDataRequestStatus = "Delete Data Request Status"
static let dataAgreements = "bb_consent_dashboard_data_agreements".localized
static let dataAttributes = "bb_consent_data_attribute_data_attributes" .localized
static let dataAgreements = "bb_consent_dashboard_data_agreements"
static let dataAttributes = "bb_consent_data_attribute_data_attributes"
}

struct URLStrings {
Expand Down
1 change: 1 addition & 0 deletions PrivacyDashboardiOS/Classes/PrivacyDashboard.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
</tableViewCellContentView>
<connections>
<outlet property="overViewLbl" destination="qBw-yN-Qoh" id="Jf8-SF-apG"/>
<outlet property="overViewTitleLbl" destination="5Y9-ut-fj2" id="lhR-K6-obd"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="HeaderCell" rowHeight="70" id="jwH-ck-M7h" customClass="BBConsentDashboardDataAgreementCell" customModule="PrivacyDashboardiOS" customModuleProvider="target">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,22 @@ extension BBConsentAttributesDetailViewController: UITableViewDelegate,UITableVi
if consent?.status?.consented == .AskMe {
askMeCell.tickImage.isHidden = false
let days : Int = (consent?.status?.days)!
askMeCell.selectedDaysLbl.text = "\(days) " + Constant.Strings.days
askMeCell.selectedDaysLbl.text = "\(days) " + Constant.Strings.days.localized
askMeCell.askMeSlider.setValue(Float(days), animated: false)
preIndexPath = indexPath

} else {
let days = 30
askMeCell.tickImage.isHidden = true
askMeCell.selectedDaysLbl.text = "\(days) " + Constant.Strings.days
askMeCell.selectedDaysLbl.text = "\(days) " + Constant.Strings.days.localized
askMeCell.askMeSlider.setValue(Float(days), animated: false)
}
return askMeCell
}
}

func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return Constant.Strings.consent
return Constant.Strings.consent.localized
}

func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
Expand All @@ -133,11 +133,11 @@ extension BBConsentAttributesDetailViewController: UITableViewDelegate,UITableVi
}

if consent?.status?.consented == .Allow {
return Constant.Strings.consentAllowedNoteOne + (consentTitle) + Constant.Strings.consentAllowedNoteTwo
return Constant.Strings.consentAllowedNoteOne.localized + (consentTitle) + Constant.Strings.consentAllowedNoteTwo
} else if consent?.status?.consented == .Disallow {
return Constant.Strings.consentDisAllowedNote
return Constant.Strings.consentDisAllowedNote.localized
} else {
return Constant.Strings.consentDefaultNote
return Constant.Strings.consentDefaultNote.localized
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class BBConsentAttributesViewController: BBConsentBaseViewController {
alerController.addAction(UIAlertAction(title: Constant.Alert.disallowAll, style: .destructive, handler: {(action:UIAlertAction) in
self.callDisallowAllApi()
}));
alerController.addAction(UIAlertAction(title: Constant.Strings.cancel, style: .cancel, handler: {(action:UIAlertAction) in
alerController.addAction(UIAlertAction(title: Constant.Strings.cancel.localized, style: .cancel, handler: {(action:UIAlertAction) in
}));
present(alerController, animated: true, completion: nil)
}
Expand Down Expand Up @@ -203,7 +203,8 @@ extension BBConsentAttributesViewController : UITableViewDelegate,UITableViewDa
orgOverViewCell.overViewLbl.delegate = self
orgOverViewCell.layoutIfNeeded()
orgOverViewCell.overViewLbl.shouldCollapse = true

orgOverViewCell.overViewTitleLbl?.text = "bb_consent_dashboard_overview".localized

if overViewCollpased == true {
// orgOverViewCell.overViewLbl.collapsed = overViewCollpased
// orgOverViewCell.overViewLbl.numberOfLines = 3
Expand Down Expand Up @@ -235,6 +236,7 @@ extension BBConsentAttributesViewController : UITableViewDelegate,UITableViewDa
consentHeaderCell.policyButton.layer.borderColor = UIColor(red:0.62, green:0.62, blue:0.62, alpha:1).cgColor
consentHeaderCell.policyButton.layer.borderWidth = 0.5
consentHeaderCell.policyButton.addTarget(self, action: #selector(policyBtnClicked), for: .touchUpInside)
consentHeaderCell.policyButton.setTitle("bb_consent_data_attribute_read_policy".localized, for: .normal)
return consentHeaderCell

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class BBConsentAskMeSliderTableViewCell: UITableViewCell {

@IBAction func sliderValueChanged(sender: UISlider) {
slidercurrentValue = Int(sender.value)
selectedDaysLbl.text = "\(slidercurrentValue) \(Constant.Strings.days)"
selectedDaysLbl.text = "\(slidercurrentValue) \(Constant.Strings.days.localized)"
self.delegate?.askMeSliderValueChanged(days: slidercurrentValue)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class BBConsentAttributeTableViewCell: UITableViewCell {
self.titleLbl.text = self.consentInfo?.name
self.dataLbl.text = ""
if consent == true {
self.consentTypeLbl.text = Constant.Strings.allow
self.consentTypeLbl.text = Constant.Strings.allow.localized
} else{
self.consentTypeLbl.text = Constant.Strings.disallow
self.consentTypeLbl.text = Constant.Strings.disallow.localized
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BBConsentAttributesHeaderCell: UITableViewCell {
@IBOutlet weak var policyButton: UIButton!
override func awakeFromNib() {
super.awakeFromNib()
dataAttributeLbl.text = Constant.Strings.dataAttributes
dataAttributeLbl.text = Constant.Strings.dataAttributes.localized
}

override func setSelected(_ selected: Bool, animated: Bool) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class BBConsentHistoryViewController: BBConsentBaseViewController {

override func viewWillAppear(_ animated: Bool) {
navigationController?.navigationBar.isHidden = false
navigationItem.title = Constant.Strings.consentHistory
navigationItem.title = Constant.Strings.consentHistory.localized
}


Expand Down Expand Up @@ -74,7 +74,7 @@ extension BBConsentHistoryViewController: WebServiceTaskManagerProtocol {
} else {
self.histories = data.consentHistory
if (self.histories?.count ?? 0) < 1 {
self.historyListTable.setState(.withImage(image: nil, title: "", message: Constant.Strings.noHistoryAbailable))
self.historyListTable.setState(.withImage(image: nil, title: "", message: Constant.Strings.noHistoryAbailable.localized))
}
}
self.historyListTable.reloadData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class BBConsentOrganisationViewController: BBConsentBaseViewController {
let actionSheetController: UIAlertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)

// Create an action
let firstAction: UIAlertAction = UIAlertAction(title: Constant.Strings.privacyPolicy, style: .default) { action -> Void in
let firstAction: UIAlertAction = UIAlertAction(title: Constant.Strings.privacyPolicy.localized, style: .default) { action -> Void in

if let privacyPolicy = self.organization?.privacyPolicy {
if self.verifyUrl(urlString: privacyPolicy) {
Expand All @@ -135,15 +135,15 @@ class BBConsentOrganisationViewController: BBConsentBaseViewController {
}
}

let secondAction: UIAlertAction = UIAlertAction(title: Constant.Strings.userRequests, style: .default) { action -> Void in
let secondAction: UIAlertAction = UIAlertAction(title: Constant.Strings.userRequests.localized, style: .default) { action -> Void in
self.showRequestedStatus()
}

let thirdAction: UIAlertAction = UIAlertAction(title: Constant.Strings.consentHistory, style: .default) { action -> Void in
let thirdAction: UIAlertAction = UIAlertAction(title: Constant.Strings.consentHistory.localized, style: .default) { action -> Void in
self.showConsentHistory()
}

let cancelAction: UIAlertAction = UIAlertAction(title: Constant.Strings.cancel, style: .cancel) { action -> Void in }
let cancelAction: UIAlertAction = UIAlertAction(title: Constant.Strings.cancel.localized, style: .cancel) { action -> Void in }

// Add actions
actionSheetController.addAction(firstAction)
Expand Down Expand Up @@ -294,7 +294,8 @@ extension BBConsentOrganisationViewController: UITableViewDelegate, UITableViewD
orgOverViewCell.overViewLbl.delegate = self
orgOverViewCell.layoutIfNeeded()
orgOverViewCell.overViewLbl.shouldCollapse = true

orgOverViewCell.overViewTitleLbl?.text = "bb_consent_dashboard_overview".localized

if overViewCollpased == true {
// orgOverViewCell.overViewLbl.collapsed = overViewCollpased
// orgOverViewCell.overViewLbl.numberOfLines = 3
Expand Down Expand Up @@ -476,12 +477,12 @@ extension BBConsentOrganisationViewController: ExpandableLabelDelegate ,PurposeC
serviceManager.updatePurpose(dataAgreementRecordId: filteredRecord?[0].id ?? "", dataAgreementId: filteredRecord?[0].dataAgreementId ?? "", status: status)
}
}));
alerController.addAction(UIAlertAction(title: Constant.Strings.cancel, style: .cancel, handler: {(action:UIAlertAction) in
alerController.addAction(UIAlertAction(title: Constant.Strings.cancel.localized, style: .cancel, handler: {(action:UIAlertAction) in
cell.statusSwitch.isOn = !cell.statusSwitch.isOn
}));

} else {
alerController.addAction(UIAlertAction(title: Constant.Strings.cancel, style: .destructive, handler: {(action:UIAlertAction) in
alerController.addAction(UIAlertAction(title: Constant.Strings.cancel.localized, style: .destructive, handler: {(action:UIAlertAction) in
cell.statusSwitch.isOn = !cell.statusSwitch.isOn
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ExpandableLabel

class BBConsentDashBoardOverviewCell: UITableViewCell {
@IBOutlet weak var overViewLbl: ExpandableLabel!

@IBOutlet weak var overViewTitleLbl: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
let attributeString: NSMutableAttributedString = NSMutableAttributedString(string: "bb_consent_dashboard_read_more".localized)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BBConsentDashboardDataAgreementCell: UITableViewCell {
@IBOutlet weak var dataAgreementsLbl: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
dataAgreementsLbl.text = Constant.Strings.dataAgreements
dataAgreementsLbl.text = Constant.Strings.dataAgreements.localized
}

override func setSelected(_ selected: Bool, animated: Bool) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class BBConsentDownloadDataProgressViewController: BBConsentBaseViewController {
@IBOutlet weak var cancelButton: UIButton!
var fromHistory = false;
let Steps = [
Constant.Strings.requestInitiated,
Constant.Strings.requestAcknowledged,
Constant.Strings.requestProcessed
Constant.Strings.requestInitiated.localized,
Constant.Strings.requestAcknowledged.localized,
Constant.Strings.requestProcessed.localized
]

override func viewDidLoad() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BBConsentRequestStatusViewController: BBConsentBaseViewController, UITable

override func viewWillAppear(_ animated: Bool) {
navigationController?.navigationBar.isHidden = false
navigationItem.title = Constant.Strings.userRequests
navigationItem.title = Constant.Strings.userRequests.localized
}

func callHistoryListApi() {
Expand Down Expand Up @@ -139,15 +139,15 @@ class BBConsentRequestStatusViewController: BBConsentBaseViewController, UITable
let actionSheetController: UIAlertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)

// Create an action
let firstAction: UIAlertAction = UIAlertAction(title: Constant.Strings.downloadData, style: .default) { _ -> Void in
let firstAction: UIAlertAction = UIAlertAction(title: Constant.Strings.downloadData.localized, style: .default) { _ -> Void in
self.getDownloadDataStatus()
}

let secondAction: UIAlertAction = UIAlertAction(title: Constant.Strings.deleteData, style: .default) { _ -> Void in
let secondAction: UIAlertAction = UIAlertAction(title: Constant.Strings.deleteData.localized, style: .default) { _ -> Void in
self.getForgetMeStatus()
}

let cancelAction: UIAlertAction = UIAlertAction(title: Constant.Strings.cancel, style: .cancel) { _ -> Void in }
let cancelAction: UIAlertAction = UIAlertAction(title: Constant.Strings.cancel.localized, style: .cancel) { _ -> Void in }

// Add actions
actionSheetController.addAction(firstAction)
Expand Down Expand Up @@ -181,7 +181,7 @@ extension BBConsentRequestStatusViewController: WebServiceTaskManagerProtocol {
} else {
histories = data.DataRequests
if (histories?.count ?? 0) < 1 {
historyListTable.setState(.withImage(image: nil, title: "", message: Constant.Strings.noHistoryAbailable))
historyListTable.setState(.withImage(image: nil, title: "", message: Constant.Strings.noHistoryAbailable.localized))
}
}
}
Expand Down

0 comments on commit df2af1d

Please sign in to comment.