From 0fe628b69b020b752be08540fcd259050d1a0587 Mon Sep 17 00:00:00 2001 From: Jag-Marcel Date: Sat, 30 Nov 2024 10:05:32 +0100 Subject: [PATCH 1/4] Corner now able to flip based on orientation of text --- Scribe/InstallationTab/InstallationVC.swift | 8 +++++++- .../i18n/.github/workflows/pr_maintainer_checklist.yaml | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Scribe/InstallationTab/InstallationVC.swift b/Scribe/InstallationTab/InstallationVC.swift index 2522d6fb..262f7e60 100644 --- a/Scribe/InstallationTab/InstallationVC.swift +++ b/Scribe/InstallationTab/InstallationVC.swift @@ -166,7 +166,13 @@ class InstallationVC: UIViewController { /// Sets properties for the app screen given the current device. func setUIDeviceProperties() { - settingsCorner.layer.maskedCorners = .layerMaxXMinYCorner + // Flips coloured corner with settings icon based on orientation of text. + settingsCorner.image = settingsCorner.image?.imageFlippedForRightToLeftLayoutDirection() + if UIView.userInterfaceLayoutDirection(for: appTextView.semanticContentAttribute) == .rightToLeft { + settingsCorner.layer.maskedCorners = .layerMinXMinYCorner // "top-left" + } else { + settingsCorner.layer.maskedCorners = .layerMaxXMinYCorner // "top-right" + } settingsCorner.layer.cornerRadius = DeviceType.isPad ? appTextBackground.frame.width * 0.02 : appTextBackground.frame.width * 0.05 settingsBtn.setTitle("", for: .normal) diff --git a/Scribe/i18n/.github/workflows/pr_maintainer_checklist.yaml b/Scribe/i18n/.github/workflows/pr_maintainer_checklist.yaml index a08810a5..a9ec944b 100644 --- a/Scribe/i18n/.github/workflows/pr_maintainer_checklist.yaml +++ b/Scribe/i18n/.github/workflows/pr_maintainer_checklist.yaml @@ -37,4 +37,3 @@ jobs: - [ ] The commit messages for the remote branch should be checked to make sure the contributor's email is set up correctly so that they receive credit for their contribution - The contributor's name and icon in remote commits should be the same as what appears in the PR - If there's a mismatch, the contributor needs to make sure that the [email they use for GitHub](https://github.com/settings/emails) matches what they have for `git config user.email` in their local activist repo - From 5d5a988471b18fc3555c9d52288a4701788fc9eb Mon Sep 17 00:00:00 2001 From: Andrew Tavis McAllister Date: Sat, 30 Nov 2024 14:06:29 +0100 Subject: [PATCH 2/4] Remove i18n readmes, fix RTL chevrons, WIP fix RTL app headers --- README.md | 8 -------- README/.keep | 0 Scribe/AboutTab/AboutTableData.swift | 2 +- Scribe/AppTexts/AppTextStyling.swift | 2 ++ Scribe/AppTexts/InstallScreen.swift | 13 +++++++++---- Scribe/Base.lproj/AppScreen.storyboard | 14 +++++++------- Scribe/SettingsTab/SettingsViewController.swift | 9 ++++++++- .../InfoChildTableViewCell.swift | 4 +++- .../UITableViewCells/AboutTableViewCell.swift | 4 +++- Scribe/i18n/Scribe-i18n/Localizable.xcstrings | 12 ------------ 10 files changed, 33 insertions(+), 35 deletions(-) delete mode 100644 README/.keep diff --git a/README.md b/README.md index 602e4050..c9020f8f 100644 --- a/README.md +++ b/README.md @@ -18,14 +18,6 @@ Available on the App Store -
🌐 Language -

- -- [Open a localization issue](https://github.com/scribe-org/Scribe-iOS/issues/new?assignees=&labels=localization&template=localization.yml) to add a new readme to the [README](https://github.com/scribe-org/Scribe-iOS/tree/main/README) directory - -

-
- ## iOS app with keyboards for language learners **Scribe-iOS** is a pack of iOS and iPadOS keyboards for language learners. Features include translation **`(beta)`**, verb conjugation and word annotation that give users the tools needed to communicate with confidence. diff --git a/README/.keep b/README/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/Scribe/AboutTab/AboutTableData.swift b/Scribe/AboutTab/AboutTableData.swift index ebc2a95e..1edd1a96 100644 --- a/Scribe/AboutTab/AboutTableData.swift +++ b/Scribe/AboutTab/AboutTableData.swift @@ -91,7 +91,7 @@ struct AboutTableData { externalLink: true ), Section( - sectionTitle: NSLocalizedString("app.about.feedback.appHints", value: "Reset app hints", comment: ""), + sectionTitle: NSLocalizedString("app.about.feedback.app_hints", value: "Reset app hints", comment: ""), imageString: "lightbulb.max", hasNestedNavigation: true, sectionState: .appHints diff --git a/Scribe/AppTexts/AppTextStyling.swift b/Scribe/AppTexts/AppTextStyling.swift index 3a86e58c..f23a2e19 100644 --- a/Scribe/AppTexts/AppTextStyling.swift +++ b/Scribe/AppTexts/AppTextStyling.swift @@ -19,6 +19,8 @@ import UIKit +let preferredLanguage = Locale.preferredLanguages[0] + var fontSize = CGFloat(0) /// Concatenates attributed strings. diff --git a/Scribe/AppTexts/InstallScreen.swift b/Scribe/AppTexts/InstallScreen.swift index 89597e3f..814bb9e6 100644 --- a/Scribe/AppTexts/InstallScreen.swift +++ b/Scribe/AppTexts/InstallScreen.swift @@ -19,11 +19,16 @@ import UIKit +let firstLineNumber = preferredLanguage.prefix(2) == "ar" ? "١. " : "1. " +let secondLineNumber = preferredLanguage.prefix(2) == "ar" ? "\n\n٢. " : "\n\n2. " +let thirdLineNumber = preferredLanguage.prefix(2) == "ar" ? "\n\n٣. " : "\n\n3. " +let fourthLineNumber = preferredLanguage.prefix(2) == "ar" ? "\n\n٤. " : "\n\n4. " + /// Formats and returns the directions of the installation guidelines. func getInstallationDirections(fontSize: CGFloat) -> NSMutableAttributedString { let globeString = getGlobeIcon(fontSize: fontSize) - let startOfBody = NSMutableAttributedString(string: "1. ", attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: fontSize)]) + let startOfBody = NSMutableAttributedString(string: firstLineNumber, attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: fontSize)]) var settingsLink = NSMutableAttributedString() let linkText = NSLocalizedString("app.installation.keyboard.scribe_settings", value: "Open Scribe settings", comment: "") @@ -35,13 +40,13 @@ func getInstallationDirections(fontSize: CGFloat) -> NSMutableAttributedString { let installStart = concatAttributedStrings(left: startOfBody, right: settingsLink) - let installDirections = NSMutableAttributedString(string: "\n\n2. " + NSLocalizedString("app.installation.keyboard.text_1", value: "Select", comment: "") + " ", attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: fontSize)]) + let installDirections = NSMutableAttributedString(string: secondLineNumber + NSLocalizedString("app.installation.keyboard.text_1", value: "Select", comment: "") + " ", attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: fontSize)]) let boldText = NSMutableAttributedString(string: NSLocalizedString("app.installation.keyboard.keyboards_bold", value: "Keyboards", comment: ""), attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: fontSize)]) boldText.addAttribute(NSAttributedString.Key.font, value: UIFont.boldSystemFont(ofSize: fontSize), range: NSRange(location: 0, length: boldText.length)) installDirections.append(boldText) - - installDirections.append(NSMutableAttributedString(string: "\n\n3. " + NSLocalizedString("app.installation.keyboard.text_2", value: "Activate keyboards that you want to use", comment: "") + "\n\n4. " + NSLocalizedString("app.installation.keyboard.text_3", value: "When typing, press", comment: "") + " ", attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: fontSize)])) + + installDirections.append(NSMutableAttributedString(string: thirdLineNumber + NSLocalizedString("app.installation.keyboard.text_2", value: "Activate keyboards that you want to use", comment: "") + fourthLineNumber + NSLocalizedString("app.installation.keyboard.text_3", value: "When typing, press", comment: "") + " ", attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: fontSize)])) installDirections.append(globeString) diff --git a/Scribe/Base.lproj/AppScreen.storyboard b/Scribe/Base.lproj/AppScreen.storyboard index 0f14ca26..ad9617ad 100644 --- a/Scribe/Base.lproj/AppScreen.storyboard +++ b/Scribe/Base.lproj/AppScreen.storyboard @@ -1,9 +1,9 @@ - + - + @@ -133,7 +133,7 @@ diff --git a/Scribe/SettingsTab/SettingsViewController.swift b/Scribe/SettingsTab/SettingsViewController.swift index 134f1f34..831494a4 100644 --- a/Scribe/SettingsTab/SettingsViewController.swift +++ b/Scribe/SettingsTab/SettingsViewController.swift @@ -229,7 +229,14 @@ extension SettingsViewController: UITableViewDelegate { headerView = UIView(frame: CGRect(x: 0, y: 0, width: parentTable.bounds.width, height: 32)) } - let label = UILabel(frame: CGRect(x: 0, y: 0, width: headerView.bounds.width, height: 32)) + let label = UILabel( + frame: CGRect( + x: preferredLanguage.prefix(2) == "ar" ? -1 * headerView.bounds.width / 10: 0, + y: 0, + width: headerView.bounds.width, + height: 32 + ) + ) label.text = tableData[section].headingTitle label.font = UIFont.boldSystemFont(ofSize: fontSize * 1.1) diff --git a/Scribe/Views/Cells/InfoChildTableViewCell/InfoChildTableViewCell.swift b/Scribe/Views/Cells/InfoChildTableViewCell/InfoChildTableViewCell.swift index 04a5ae77..dcfc57cc 100644 --- a/Scribe/Views/Cells/InfoChildTableViewCell/InfoChildTableViewCell.swift +++ b/Scribe/Views/Cells/InfoChildTableViewCell/InfoChildTableViewCell.swift @@ -121,7 +121,9 @@ final class InfoChildTableViewCell: UITableViewCell { toggleSwitch.onTintColor = .init(ScribeColor.scribeCTA).withAlphaComponent(0.4) toggleSwitch.thumbTintColor = toggleSwitch.isOn ? .init(.scribeCTA) : .lightGray } else { - iconImageView.image = UIImage(systemName: "chevron.right") + iconImageView.image = UIImage( + systemName: preferredLanguage.prefix(2) == "ar" ? "chevron.left": "chevron.right" + ) iconImageView.tintColor = menuOptionColor toggleSwitch.isHidden = true } diff --git a/Scribe/Views/Cells/UITableViewCells/AboutTableViewCell.swift b/Scribe/Views/Cells/UITableViewCells/AboutTableViewCell.swift index 40641f6a..8644c6d4 100644 --- a/Scribe/Views/Cells/UITableViewCells/AboutTableViewCell.swift +++ b/Scribe/Views/Cells/UITableViewCells/AboutTableViewCell.swift @@ -87,7 +87,9 @@ final class AboutTableViewCell: UITableViewCell { if section.hasNestedNavigation { let resetIcon = UIImage(systemName: "arrow.circlepath") - let disclosureIcon = UIImage(systemName: "chevron.right") + let disclosureIcon = UIImage( + systemName: preferredLanguage.prefix(2) == "ar" ? "chevron.left": "chevron.right" + ) let rightIcon = section.sectionState == .appHints ? resetIcon : disclosureIcon let accessory = UIImageView( frame: CGRect( diff --git a/Scribe/i18n/Scribe-i18n/Localizable.xcstrings b/Scribe/i18n/Scribe-i18n/Localizable.xcstrings index df001a3f..c63ddd20 100644 --- a/Scribe/i18n/Scribe-i18n/Localizable.xcstrings +++ b/Scribe/i18n/Scribe-i18n/Localizable.xcstrings @@ -1369,7 +1369,6 @@ }, "app.about.feedback.app_hints" : { "comment" : "", - "extractionState" : "stale", "localizations" : { "ar" : { "stringUnit" : { @@ -1433,17 +1432,6 @@ } } }, - "app.about.feedback.appHints" : { - "extractionState" : "extracted_with_value", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "new", - "value" : "Reset app hints" - } - } - } - }, "app.about.feedback.bug_report" : { "comment" : "", "localizations" : { From 5962b426709a1bc4571237f9fb67077c4329b9e1 Mon Sep 17 00:00:00 2001 From: Andrew Tavis McAllister Date: Sat, 30 Nov 2024 14:09:44 +0100 Subject: [PATCH 3/4] Fix trailing whitespace issue --- Scribe/AppTexts/InstallScreen.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scribe/AppTexts/InstallScreen.swift b/Scribe/AppTexts/InstallScreen.swift index 814bb9e6..730a7070 100644 --- a/Scribe/AppTexts/InstallScreen.swift +++ b/Scribe/AppTexts/InstallScreen.swift @@ -45,7 +45,7 @@ func getInstallationDirections(fontSize: CGFloat) -> NSMutableAttributedString { let boldText = NSMutableAttributedString(string: NSLocalizedString("app.installation.keyboard.keyboards_bold", value: "Keyboards", comment: ""), attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: fontSize)]) boldText.addAttribute(NSAttributedString.Key.font, value: UIFont.boldSystemFont(ofSize: fontSize), range: NSRange(location: 0, length: boldText.length)) installDirections.append(boldText) - + installDirections.append(NSMutableAttributedString(string: thirdLineNumber + NSLocalizedString("app.installation.keyboard.text_2", value: "Activate keyboards that you want to use", comment: "") + fourthLineNumber + NSLocalizedString("app.installation.keyboard.text_3", value: "When typing, press", comment: "") + " ", attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: fontSize)])) installDirections.append(globeString) From d48c3a34edb8fe3c05b772e907943c39275a7c52 Mon Sep 17 00:00:00 2001 From: Andrew Tavis McAllister Date: Sat, 30 Nov 2024 14:12:09 +0100 Subject: [PATCH 4/4] Update changelog for RTL app text changes --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe8681a8..7eab45e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ Emojis for the following are chosen based on [gitmoji](https://gitmoji.dev/). - All orphaned documentation comments have been removed from the codebase ([#425](https://github.com/scribe-org/Scribe-iOS/issues/425)). - All if clauses within for loops have been removed from the codebase ([#428](https://github.com/scribe-org/Scribe-iOS/issues/428)). +- The app interface was refactored to allow for right to left languages for the app texts ([#513](https://github.com/scribe-org/Scribe-iOS/issues/513)). # Scribe-iOS 3.1.1