Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flip install screen corner for RTL languages #516

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@

<a href='https://apps.apple.com/app/scribe-language-keyboards/id1596613886'><img alt='Available on the App Store' src='https://raw.githubusercontent.com/scribe-org/Scribe-iOS/main/.github/resources/images/app_store_badge.png' height='60px'/></a>

<details><summary>🌐 Language</summary>
<p>

- [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

</p>
</details>

## 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.
Expand Down
Empty file removed README/.keep
Empty file.
2 changes: 1 addition & 1 deletion Scribe/AboutTab/AboutTableData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Scribe/AppTexts/AppTextStyling.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import UIKit

let preferredLanguage = Locale.preferredLanguages[0]

var fontSize = CGFloat(0)

/// Concatenates attributed strings.
Expand Down
11 changes: 8 additions & 3 deletions Scribe/AppTexts/InstallScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: "")
Expand All @@ -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)

Expand Down
14 changes: 7 additions & 7 deletions Scribe/Base.lproj/AppScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="z4h-ME-igh">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="z4h-ME-igh">
<device id="retina5_9" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
Expand Down Expand Up @@ -133,7 +133,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="316.33333333333331"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="none" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hsr-GS-NQS" userLabel="HeadingLabelPhone">
<rect key="frame" x="15.000000000000004" y="20" width="44.333333333333343" height="21"/>
<rect key="frame" x="15" y="20" width="345" height="21"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="21" id="UI5-ex-Fun"/>
</constraints>
Expand Down Expand Up @@ -181,7 +181,7 @@
<constraint firstItem="61J-Jd-qbi" firstAttribute="leading" secondItem="XYp-UM-US6" secondAttribute="leading" constant="15" id="KJR-dY-kza"/>
<constraint firstAttribute="bottom" secondItem="61J-Jd-qbi" secondAttribute="bottom" constant="8" id="Vyt-QG-c4M"/>
<constraint firstItem="61J-Jd-qbi" firstAttribute="top" secondItem="Hsr-GS-NQS" secondAttribute="bottom" constant="4" id="feV-zw-mjH"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="Hsr-GS-NQS" secondAttribute="trailing" constant="20" symbolic="YES" id="g1Q-zd-LHB"/>
<constraint firstAttribute="trailing" secondItem="Hsr-GS-NQS" secondAttribute="trailing" constant="15" id="g1Q-zd-LHB"/>
<constraint firstItem="Hsr-GS-NQS" firstAttribute="top" secondItem="XYp-UM-US6" secondAttribute="top" constant="20" symbolic="YES" id="uJN-FA-Nt5"/>
</constraints>
</view>
Expand Down Expand Up @@ -348,7 +348,7 @@
<color key="backgroundColor" systemColor="systemBrownColor"/>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jrH-BQ-4ti" userLabel="InstallationLabel">
<rect key="frame" x="15.000000000000004" y="219.66666666666666" width="44.333333333333343" height="20.333333333333343"/>
<rect key="frame" x="15" y="219.66666666666666" width="345" height="20.333333333333343"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand Down Expand Up @@ -472,7 +472,7 @@
<constraint firstItem="Oxz-Zq-2g7" firstAttribute="top" secondItem="eyk-EK-raM" secondAttribute="bottom" id="vNz-Be-acs"/>
<constraint firstItem="xOG-9z-mVQ" firstAttribute="height" secondItem="6Tk-OE-BBY" secondAttribute="height" multiplier="0.05" id="xhQ-Iw-ZFa"/>
<constraint firstItem="Oxz-Zq-2g7" firstAttribute="height" secondItem="6Tk-OE-BBY" secondAttribute="height" multiplier="0.15" id="yJI-k4-sar"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="jrH-BQ-4ti" secondAttribute="trailing" symbolic="YES" id="zOe-dD-pB6"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="jrH-BQ-4ti" secondAttribute="trailing" constant="15" id="zOe-dD-pB6"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="Installation" image="keyboard" catalog="system" id="HNz-5D-1T0"/>
Expand Down Expand Up @@ -611,7 +611,7 @@
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="systemBrownColor">
<color red="0.63529411764705879" green="0.51764705882352946" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.63529411759999999" green="0.51764705879999995" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
8 changes: 7 additions & 1 deletion Scribe/InstallationTab/InstallationVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 8 additions & 1 deletion Scribe/SettingsTab/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 3 additions & 1 deletion Scribe/Views/Cells/UITableViewCells/AboutTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 0 additions & 1 deletion Scribe/i18n/.github/workflows/pr_maintainer_checklist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

12 changes: 0 additions & 12 deletions Scribe/i18n/Scribe-i18n/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,6 @@
},
"app.about.feedback.app_hints" : {
"comment" : "",
"extractionState" : "stale",
"localizations" : {
"ar" : {
"stringUnit" : {
Expand Down Expand Up @@ -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" : {
Expand Down