Skip to content

Commit

Permalink
Add back English keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Jag-Marcel committed Aug 2, 2024
1 parent c971950 commit 78cb944
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 38 deletions.
2 changes: 2 additions & 0 deletions Keyboards/KeyboardsBase/InterfaceVariables.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ var controllerLanguageAbbr = String()

// Dictionary for accessing language abbreviations.
let languagesAbbrDict = [
"English": "en",
"French": "fr",
"German": "de",
"Italian": "it",
Expand All @@ -183,6 +184,7 @@ func getControllerLanguageAbbr() -> String {
// Dictionary for accessing keyboard abbreviations and layouts.
let keyboardLayoutDict: [String: () -> Void] = [
// Layouts for French checked within setFRKeyboardLayout.
"English": setENKeyboardLayout,
"French": setFRKeyboardLayout,
"German": setDEKeyboardLayout,
"Italian": setITKeyboardLayout,
Expand Down
14 changes: 12 additions & 2 deletions Keyboards/KeyboardsBase/KeyboardKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,12 @@ class KeyboardKey: UIButton {
widthAnchor.constraint(equalToConstant: numSymKeyWidth * scalarReturnKeyWidth).isActive = true
} else if ["123", ".?123", "return", "hideKeyboard"].contains(key) {
if key == "return"
&& (controllerLanguage == "Portuguese" || controllerLanguage == "Italian" || commandState == .translate)
&& (
controllerLanguage == "English"
|| controllerLanguage == "Portuguese"
|| controllerLanguage == "Italian"
|| commandState == .translate
)
&& row == 1
&& DeviceType.isPad {
layer.setValue(true, forKey: "isSpecial")
Expand All @@ -303,7 +308,12 @@ class KeyboardKey: UIButton {
widthAnchor.constraint(equalToConstant: numSymKeyWidth * 1).isActive = true
} else if ["123", ".?123", "return", "hideKeyboard"].contains(key) {
if key == "return"
&& (controllerLanguage == "Portuguese" || controllerLanguage == "Italian" || commandState == .translate)
&& (
controllerLanguage == "English"
|| controllerLanguage == "Portuguese"
|| controllerLanguage == "Italian"
|| commandState == .translate
)
&& row == 1
&& DeviceType.isPad {
layer.setValue(true, forKey: "isSpecial")
Expand Down
21 changes: 15 additions & 6 deletions Keyboards/KeyboardsBase/KeyboardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ class KeyboardViewController: UIInputViewController {

if prefix.isNumeric {
completionWords = numericAutosuggestions
} else if ["French", "German", "Spanish"].contains(controllerLanguage) && pronounAutosuggestionTenses.keys.contains(prefix.lowercased()) {
} else if ["English", "French", "German", "Spanish"].contains(controllerLanguage) && pronounAutosuggestionTenses.keys.contains(prefix.lowercased()) {
getPronounAutosuggestions()
} else {
// We have to consider these different cases as the key always has to match.
Expand Down Expand Up @@ -1653,7 +1653,9 @@ class KeyboardViewController: UIInputViewController {
}
if DeviceType.isPhone
&& key == "a"
&& (controllerLanguage == "Portuguese"
&& (
controllerLanguage == "English"
|| controllerLanguage == "Portuguese"
|| controllerLanguage == "Italian"
|| commandState == .translate
|| (
Expand All @@ -1671,7 +1673,8 @@ class KeyboardViewController: UIInputViewController {
&& key == "a"
&& !usingExpandedKeyboard
&& (
controllerLanguage == "Portuguese"
controllerLanguage == "English"
|| controllerLanguage == "Portuguese"
|| controllerLanguage == "Italian"
|| commandState == .translate
) {
Expand All @@ -1681,7 +1684,9 @@ class KeyboardViewController: UIInputViewController {
if DeviceType.isPad
&& key == "@"
&& !usingExpandedKeyboard
&& (controllerLanguage == "Portuguese"
&& (
controllerLanguage == "English"
|| controllerLanguage == "Portuguese"
|| controllerLanguage == "Italian"
|| commandState == .translate) {
leftPadding = keyWidth / 3
Expand All @@ -1690,7 +1695,9 @@ class KeyboardViewController: UIInputViewController {
if DeviceType.isPad
&& key == ""
&& !usingExpandedKeyboard
&& (controllerLanguage == "Portuguese"
&& (
controllerLanguage == "English"
|| controllerLanguage == "Portuguese"
|| commandState == .translate) {
leftPadding = keyWidth / 3
addPadding(to: stackView1, width: leftPadding, key: "")
Expand Down Expand Up @@ -1786,7 +1793,9 @@ class KeyboardViewController: UIInputViewController {
}
if DeviceType.isPhone
&& key == "l"
&& (controllerLanguage == "Portuguese"
&& (
controllerLanguage == "English"
|| controllerLanguage == "Portuguese"
|| controllerLanguage == "Italian"
|| commandState == .translate
|| (
Expand Down
15 changes: 12 additions & 3 deletions Keyboards/KeyboardsBase/ScribeFunctionality/Conjugate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import UIKit

// Dictionary for accessing keyboard conjugation state.
let keyboardConjTitleDict: [String: Any] = [
"English": enGetConjugationTitle,
"French": frGetConjugationTitle,
"German": deGetConjugationTitle,
"Italian": itGetConjugationTitle,
Expand All @@ -32,6 +33,7 @@ let keyboardConjTitleDict: [String: Any] = [

// Dictionary for accessing keyboard conjugation state.
let keyboardConjStateDict: [String: Any] = [
"English": enGetConjugationState,
"French": frGetConjugationState,
"German": deGetConjugationState,
"Italian": itGetConjugationState,
Expand All @@ -43,6 +45,7 @@ let keyboardConjStateDict: [String: Any] = [

// Dictionary for accessing keyboard conjugation state.
let keyboardConjLabelDict: [String: Any] = [
"English": enSetConjugationLabels,
"French": frSetConjugationLabels,
"German": deSetConjugationLabels,
"Italian": itSetConjugationLabels,
Expand Down Expand Up @@ -278,7 +281,9 @@ func returnConjugation(keyPressed: UIButton, requestedForm: String) {
/// Returns the conjugation state to its initial conjugation based on the keyboard language.
func resetVerbConjugationState() {
conjViewShiftButtonsState = .leftInactive
if controllerLanguage.prefix("French".count) == "French" {
if controllerLanguage == "English" {
enConjugationState = .present
} else if controllerLanguage.prefix("French".count) == "French" {
frConjugationState = .indicativePresent
} else if controllerLanguage == "German" {
deConjugationState = .indicativePresent
Expand Down Expand Up @@ -331,7 +336,9 @@ func resetCaseDeclensionState() {

/// Runs an action associated with the left view switch button of the conjugation state based on the keyboard language.
func conjugationStateLeft() {
if controllerLanguage.prefix("French".count) == "French" {
if controllerLanguage == "English" {
enConjugationStateLeft()
} else if controllerLanguage.prefix("French".count) == "French" {
frConjugationStateLeft()
} else if controllerLanguage == "German" {
deConjugationStateLeft()
Expand All @@ -350,7 +357,9 @@ func conjugationStateLeft() {

/// Runs an action associated with the right view switch button of the conjugation state based on the keyboard language.
func conjugationStateRight() {
if controllerLanguage.prefix("French".count) == "French" {
if controllerLanguage == "English" {
enConjugationStateRight()
} else if controllerLanguage.prefix("French".count) == "French" {
frConjugationStateRight()
} else if controllerLanguage == "German" {
deConjugationStateRight()
Expand Down
2 changes: 2 additions & 0 deletions Keyboards/KeyboardsBase/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
func get_iso_code(keyboardLanguage: String) -> String {
var iso = ""
switch keyboardLanguage {
case "English":
iso = "en"
case "French":
iso = "fr"
case "German":
Expand Down
18 changes: 18 additions & 0 deletions Scribe.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@
38BD215322D592CA00C6795D /* German.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 38BD214C22D592CA00C6795D /* German.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
38DD94F122D6A40000FF8845 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38DD94F022D6A40000FF8845 /* Extensions.swift */; };
5A0A4C2E2C207C34003ADE27 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 5A0A4C2B2C207C34003ADE27 /* Localizable.xcstrings */; };
5A0A4C352C2AF52D003ADE27 /* RadioTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5A0A4C342C2AF52D003ADE27 /* RadioTableViewCell.xib */; };
5A0A4C372C2B0B28003ADE27 /* SelectionViewTemplateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A0A4C362C2B0B28003ADE27 /* SelectionViewTemplateViewController.swift */; };
5A0A4C392C2C6AC0003ADE27 /* RadioTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A0A4C382C2C6AC0003ADE27 /* RadioTableViewCell.swift */; };
5A8FFB6B2C5A9D9C00F4B571 /* English.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = D1AFDF3D29CA66D00033BF27 /* English.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
69B81EBC2BFB8C77008CAB85 /* TipCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69B81EBB2BFB8C77008CAB85 /* TipCardView.swift */; };
84AF4D882C3575EA009AE0D2 /* UIDeviceExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AF4D872C3575EA009AE0D2 /* UIDeviceExtensions.swift */; };
CE1378C428F5D7AC00E1CBC2 /* ScribeColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE1378C228F5D7AC00E1CBC2 /* ScribeColor.swift */; };
Expand Down Expand Up @@ -753,6 +757,13 @@
remoteGlobalIDString = 38BD214B22D592CA00C6795D;
remoteInfo = typEmoji;
};
5A8FFB6C2C5A9D9C00F4B571 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 38BD212822D5907E00C6795D /* Project object */;
proxyType = 1;
remoteGlobalIDString = D1AFDF0029CA66D00033BF27;
remoteInfo = English;
};
D109A210275B6888005E2271 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 38BD212822D5907E00C6795D /* Project object */;
Expand Down Expand Up @@ -835,6 +846,7 @@
D1B81D2627BBB5320085FE5E /* Italian.appex in Embed Foundation Extensions */,
D18EA8A02760D4A6001E1358 /* Swedish.appex in Embed Foundation Extensions */,
38BD215322D592CA00C6795D /* German.appex in Embed Foundation Extensions */,
5A8FFB6B2C5A9D9C00F4B571 /* English.appex in Embed Foundation Extensions */,
D109A221275B68B3005E2271 /* Portuguese.appex in Embed Foundation Extensions */,
D160866C270B6D3C00134D48 /* Spanish.appex in Embed Foundation Extensions */,
D109A212275B6888005E2271 /* French.appex in Embed Foundation Extensions */,
Expand Down Expand Up @@ -1550,6 +1562,7 @@
D1AFDFC029CA68610033BF27 /* PBXTargetDependency */,
D1AFDFC329CA68660033BF27 /* PBXTargetDependency */,
D1AFE01529CA6F980033BF27 /* PBXTargetDependency */,
5A8FFB6D2C5A9D9C00F4B571 /* PBXTargetDependency */,
);
name = Scribe;
packageProductDependencies = (
Expand Down Expand Up @@ -2772,6 +2785,11 @@
target = 38BD214B22D592CA00C6795D /* German */;
targetProxy = 38BD215122D592CA00C6795D /* PBXContainerItemProxy */;
};
5A8FFB6D2C5A9D9C00F4B571 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = D1AFDF0029CA66D00033BF27 /* English */;
targetProxy = 5A8FFB6C2C5A9D9C00F4B571 /* PBXContainerItemProxy */;
};
D109A211275B6888005E2271 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = D109A20A275B6888005E2271 /* French */;
Expand Down
54 changes: 27 additions & 27 deletions Scribe/Assets.xcassets/linkCornerBackground.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
{
"images": [
"images" : [
{
"filename": "cornerBackgroundLight.png",
"idiom": "universal",
"scale": "1x"
"filename" : "cornerBackgroundLight.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"appearances": [
"appearances" : [
{
"appearance": "luminosity",
"value": "dark"
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename": "cornerBackgroundDark.png",
"idiom": "universal",
"scale": "1x"
"filename" : "CornerBackgroundDark.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom": "universal",
"scale": "2x"
"idiom" : "universal",
"scale" : "2x"
},
{
"appearances": [
"appearances" : [
{
"appearance": "luminosity",
"value": "dark"
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom": "universal",
"scale": "2x"
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom": "universal",
"scale": "3x"
"idiom" : "universal",
"scale" : "3x"
},
{
"appearances": [
"appearances" : [
{
"appearance": "luminosity",
"value": "dark"
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom": "universal",
"scale": "3x"
"idiom" : "universal",
"scale" : "3x"
}
],
"info": {
"author": "xcode",
"version": 1
"info" : {
"author" : "xcode",
"version" : 1
}
}

0 comments on commit 78cb944

Please sign in to comment.