diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fab665b..bae6f8eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ Emojis for the following are chosen based on [gitmoji](https://gitmoji.dev/). # [Upcoming] Scribe-iOS 3.2.0 +### ⌨️ New Keyboards + +- Adds an English keyboard ([#7](https://github.com/scribe-org/Scribe-iOS/issues/7)). + ### ✨ New Features - Scribe commands can now be triggered directly on a selected word by pressing the Scribe key and then choosing which command to use ([#141](https://github.com/scribe-org/Scribe-iOS/issues/141)). @@ -31,6 +35,10 @@ Emojis for the following are chosen based on [gitmoji](https://gitmoji.dev/). - Localization strings for English, German, Swedish and Spanish have been added for all remaining app texts ([Scribe-i18n#28](https://github.com/scribe-org/Scribe-i18n/issues/28)). +### 🐞 Bug Fixes + +- The plural command now reacts to the capitalization of the input word when a word that's already plural is entered. + # Scribe-iOS 3.1.0 ### ✨ New Features diff --git a/Keyboards/KeyboardsBase/Extensions.swift b/Keyboards/KeyboardsBase/Extensions.swift index c6823b24..8a1fd3e6 100644 --- a/Keyboards/KeyboardsBase/Extensions.swift +++ b/Keyboards/KeyboardsBase/Extensions.swift @@ -1,5 +1,5 @@ /** - * Extensions for Scribe keyboards. + * Extensions with helper functions for Scribe keyboards. * * Copyright (C) 2024 Scribe * diff --git a/Keyboards/KeyboardsBase/InterfaceVariables.swift b/Keyboards/KeyboardsBase/InterfaceVariables.swift index 835773bd..6e16e3fe 100644 --- a/Keyboards/KeyboardsBase/InterfaceVariables.swift +++ b/Keyboards/KeyboardsBase/InterfaceVariables.swift @@ -163,6 +163,7 @@ var controllerLanguageAbbr = String() // Dictionary for accessing language abbreviations. let languagesAbbrDict = [ + "English": "en", "French": "fr", "German": "de", "Italian": "it", @@ -194,6 +195,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, diff --git a/Keyboards/KeyboardsBase/KeyboardKeys.swift b/Keyboards/KeyboardsBase/KeyboardKeys.swift index 5576bbb5..947cad45 100644 --- a/Keyboards/KeyboardsBase/KeyboardKeys.swift +++ b/Keyboards/KeyboardsBase/KeyboardKeys.swift @@ -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") @@ -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") diff --git a/Keyboards/KeyboardsBase/KeyboardViewController.swift b/Keyboards/KeyboardsBase/KeyboardViewController.swift index 44930e2f..54fad788 100644 --- a/Keyboards/KeyboardsBase/KeyboardViewController.swift +++ b/Keyboards/KeyboardsBase/KeyboardViewController.swift @@ -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. @@ -1264,6 +1264,15 @@ class KeyboardViewController: UIInputViewController { .genitiveDefinite, .genitiveIndefinite, .genitiveDemonstrative ].contains(deCaseDeclensionState) { formsDisplayDimensions = .view2x2 + } else if controllerLanguage == "English" { + switch enConjugationState { + case .present, .presCont, .past, .future, .conditional: + formsDisplayDimensions = .view2x2 + case .presSimp, .presPerf, .presPerfCont: + formsDisplayDimensions = .view1x2 + case .pastCont: + formsDisplayDimensions = .view3x1 + } } else if commandState == .displayInformation { formsDisplayDimensions = .view1x1 } else { @@ -1423,7 +1432,7 @@ class KeyboardViewController: UIInputViewController { conjugationStateFxn = conjugationFxn } - if !["Russian", "Swedish"].contains(controllerLanguage) { + if !["English", "Russian", "Swedish"].contains(controllerLanguage) { formFPS = conjugationStateFxn() + "FPS" formSPS = conjugationStateFxn() + "SPS" formTPS = conjugationStateFxn() + "TPS" @@ -1451,6 +1460,24 @@ class KeyboardViewController: UIInputViewController { formTopRight = swedishTenses[1] formBottomLeft = swedishTenses[2] formBottomRight = swedishTenses[3] + } else if controllerLanguage == "English" { + if formsDisplayDimensions == .view2x2 { + let englishTenses = enGetConjugationState() + + formTopLeft = englishTenses[0] + formTopRight = englishTenses[1] + formBottomLeft = englishTenses[2] + formBottomRight = englishTenses[3] + } else if formsDisplayDimensions == .view1x2 { + let englishTenses = enGetConjugationState() + + formLeft = englishTenses[0] + formRight = englishTenses[1] + } else if formsDisplayDimensions == .view3x1 { + formTop = "presPart" + formMiddle = "pastSimpCont" + formBottom = "pastSimpPluralCont" + } } } @@ -1481,7 +1508,6 @@ class KeyboardViewController: UIInputViewController { } // Assign labels that have been set by SetConjugationLabels function. - // Other labels not assigned as they're not used in conjugation at this time. formLblFPS.setTitle(" " + (formLabelsDict["FPS"] ?? ""), for: .normal) formLblSPS.setTitle(" " + (formLabelsDict["SPS"] ?? ""), for: .normal) formLblTPS.setTitle(" " + (formLabelsDict["TPS"] ?? ""), for: .normal) @@ -1489,17 +1515,33 @@ class KeyboardViewController: UIInputViewController { formLblSPP.setTitle(" " + (formLabelsDict["SPP"] ?? ""), for: .normal) formLblTPP.setTitle(" " + (formLabelsDict["TPP"] ?? ""), for: .normal) + formLblTop.setTitle(" " + (formLabelsDict["Top"] ?? ""), for: .normal) + formLblMiddle.setTitle(" " + (formLabelsDict["Middle"] ?? ""), for: .normal) + formLblBottom.setTitle(" " + (formLabelsDict["Bottom"] ?? ""), for: .normal) + formLblTL.setTitle(" " + (formLabelsDict["TL"] ?? ""), for: .normal) formLblTR.setTitle(" " + (formLabelsDict["TR"] ?? ""), for: .normal) formLblBL.setTitle(" " + (formLabelsDict["BL"] ?? ""), for: .normal) formLblBR.setTitle(" " + (formLabelsDict["BR"] ?? ""), for: .normal) - if formsDisplayDimensions == .view3x2 { + formLblLeft.setTitle(" " + (formLabelsDict["Left"] ?? ""), for: .normal) + formLblRight.setTitle(" " + (formLabelsDict["Right"] ?? ""), for: .normal) + + switch formsDisplayDimensions { + case .view3x2: allConjugations = [formFPS, formSPS, formTPS, formFPP, formSPP, formTPP] allConjugationBtns = get3x2FormDisplayButtons() - } else { + case .view3x1: + allConjugations = [formTop, formMiddle, formBottom] + allConjugationBtns = get3x1FormDisplayButtons() + case .view2x2: allConjugations = [formTopLeft, formTopRight, formBottomLeft, formBottomRight] allConjugationBtns = get2x2FormDisplayButtons() + case .view1x2: + allConjugations = [formLeft, formRight] + allConjugationBtns = get1x2FormDisplayButtons() + case .view1x1: + break } // Populate conjugation view buttons. @@ -1511,8 +1553,28 @@ class KeyboardViewController: UIInputViewController { styleBtn(btn: allConjugationBtns[index], title: invalidCommandMsg, radius: keyCornerRadius) } else { conjugationToDisplay = conjugationsToDisplay[index] - if inputWordIsCapitalized && deConjugationState != .indicativePerfect { - conjugationToDisplay = conjugationToDisplay.capitalized + if controllerLanguage == "English" { + if index == 0 && allConjugations[index] == "presTPS" { + let simple = LanguageDBManager.shared.queryVerb(of: verbToConjugate, with: ["presSimp"]) + conjugationToDisplay = simple[0] + "/" + conjugationToDisplay + } else if index == 1 && allConjugations[index] == "presPart" { + if enConjugationState == .present { + conjugationToDisplay = "am/are/is " + conjugationToDisplay + } else { + conjugationToDisplay = "was/were " + conjugationToDisplay + } + } else if index == 3 && allConjugations[index] == "presPerfTPS" { + conjugationToDisplay = "have/" + conjugationToDisplay + } else if index == 3 && allConjugations[index] == "presPerfTPSCont" { + conjugationToDisplay = "have/" + conjugationToDisplay + } + } + if inputWordIsCapitalized { + if controllerLanguage == "English", conjugationToDisplay.count(of: " ") > 0 { + conjugationToDisplay = conjugationToDisplay.capitalize() + } else if deConjugationState != .indicativePerfect { + conjugationToDisplay = conjugationToDisplay.capitalized + } } styleBtn(btn: allConjugationBtns[index], title: conjugationToDisplay, radius: keyCornerRadius) } @@ -1653,7 +1715,9 @@ class KeyboardViewController: UIInputViewController { } if DeviceType.isPhone && key == "a" - && (controllerLanguage == "Portuguese" + && ( + controllerLanguage == "English" + || controllerLanguage == "Portuguese" || controllerLanguage == "Italian" || commandState == .translate || ( @@ -1671,7 +1735,8 @@ class KeyboardViewController: UIInputViewController { && key == "a" && !usingExpandedKeyboard && ( - controllerLanguage == "Portuguese" + controllerLanguage == "English" + || controllerLanguage == "Portuguese" || controllerLanguage == "Italian" || commandState == .translate ) { @@ -1681,7 +1746,9 @@ class KeyboardViewController: UIInputViewController { if DeviceType.isPad && key == "@" && !usingExpandedKeyboard - && (controllerLanguage == "Portuguese" + && ( + controllerLanguage == "English" + || controllerLanguage == "Portuguese" || controllerLanguage == "Italian" || commandState == .translate) { leftPadding = keyWidth / 3 @@ -1690,7 +1757,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: "€") @@ -1786,7 +1855,9 @@ class KeyboardViewController: UIInputViewController { } if DeviceType.isPhone && key == "l" - && (controllerLanguage == "Portuguese" + && ( + controllerLanguage == "English" + || controllerLanguage == "Portuguese" || controllerLanguage == "Italian" || commandState == .translate || ( @@ -2402,19 +2473,46 @@ class KeyboardViewController: UIInputViewController { loadKeys() case "formTopLeft": - returnConjugation(keyPressed: sender, requestedForm: formTopLeft) + if controllerLanguage == "English" && enConjugationState == .present { + enConjugationState = .presSimp + conjViewShiftButtonsState = .bothInactive + } else { + returnConjugation(keyPressed: sender, requestedForm: formTopLeft) + } loadKeys() case "formTopRight": - returnConjugation(keyPressed: sender, requestedForm: formTopRight) + if controllerLanguage == "English" { + if enConjugationState == .present { + enConjugationState = .presCont + conjViewShiftButtonsState = .bothInactive + } else if enConjugationState == .past { + enConjugationState = .pastCont + conjViewShiftButtonsState = .bothInactive + } else { + returnConjugation(keyPressed: sender, requestedForm: formTopRight) + } + } else { + returnConjugation(keyPressed: sender, requestedForm: formTopRight) + } loadKeys() case "formBottomLeft": - returnConjugation(keyPressed: sender, requestedForm: formBottomLeft) + if controllerLanguage == "English" && enConjugationState == .present { + enConjugationState = .presPerf + conjViewShiftButtonsState = .bothInactive + } else { + returnConjugation(keyPressed: sender, requestedForm: formBottomLeft) + } loadKeys() case "formBottomRight": - returnConjugation(keyPressed: sender, requestedForm: formBottomRight) + if controllerLanguage == "English" && enConjugationState == .present { + enConjugationState = .presPerfCont + conjViewShiftButtonsState = .bothInactive + } else { + returnConjugation(keyPressed: sender, requestedForm: formBottomRight) + } loadKeys() case "formLeft": diff --git a/Keyboards/KeyboardsBase/LanguageDBManager.swift b/Keyboards/KeyboardsBase/LanguageDBManager.swift index 4e8623ce..1aa3e2a4 100644 --- a/Keyboards/KeyboardsBase/LanguageDBManager.swift +++ b/Keyboards/KeyboardsBase/LanguageDBManager.swift @@ -250,7 +250,7 @@ extension LanguageDBManager { word = ? """ let args = [word] - let outputCols = ["suggestion_0", "suggestion_1", "suggestion_2"] + let outputCols = ["autosuggestion_0", "autosuggestion_1", "autosuggestion_2"] return queryDBRow(query: query, outputCols: outputCols, args: StatementArguments(args)) } @@ -267,7 +267,7 @@ extension LanguageDBManager { WHERE word = ? """ - let outputCols = ["emoji_0", "emoji_1", "emoji_2"] + let outputCols = ["emoji_keyword_0", "emoji_keyword_1", "emoji_keyword_2"] let args = [word] return queryDBRow(query: query, outputCols: outputCols, args: StatementArguments(args)) diff --git a/Keyboards/KeyboardsBase/ScribeFunctionality/CommandVariables.swift b/Keyboards/KeyboardsBase/ScribeFunctionality/CommandVariables.swift index a8d65091..1eab39ca 100644 --- a/Keyboards/KeyboardsBase/ScribeFunctionality/CommandVariables.swift +++ b/Keyboards/KeyboardsBase/ScribeFunctionality/CommandVariables.swift @@ -155,8 +155,8 @@ var formLabelsDict = [ "SPP": "", "TPP": "", "Top": "", - "Bottom": "", "Middle": "", + "Bottom": "", "TL": "", "TR": "", "BL": "", diff --git a/Keyboards/KeyboardsBase/ScribeFunctionality/Conjugate.swift b/Keyboards/KeyboardsBase/ScribeFunctionality/Conjugate.swift index 2f29db08..2e62b54b 100644 --- a/Keyboards/KeyboardsBase/ScribeFunctionality/Conjugate.swift +++ b/Keyboards/KeyboardsBase/ScribeFunctionality/Conjugate.swift @@ -21,6 +21,7 @@ import UIKit // Dictionary for accessing keyboard conjugation state. let keyboardConjTitleDict: [String: Any] = [ + "English": enGetConjugationTitle, "French": frGetConjugationTitle, "German": deGetConjugationTitle, "Italian": itGetConjugationTitle, @@ -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, @@ -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, @@ -254,12 +257,45 @@ func returnConjugation(keyPressed: UIButton, requestedForm: String) { } else { proxy.insertText(wordToReturn + getOptionalSpace()) } + } else if formsDisplayDimensions == .view3x1 { + wordToReturn = LanguageDBManager.shared.queryVerb(of: verbToConjugate, with: outputCols)[0] + potentialWordsToReturn = wordToReturn.components(separatedBy: getOptionalSpace()) + + if inputWordIsCapitalized { + if controllerLanguage == "English", potentialWordsToReturn.count > 1 { + // Don't return a space as well as we have a perfect verb and the cursor will be between. + proxy.insertText(wordToReturn.capitalize()) + } else { + proxy.insertText(wordToReturn.capitalized + getOptionalSpace()) + } + } else { + proxy.insertText(wordToReturn + getOptionalSpace()) + } } else if formsDisplayDimensions == .view2x2 { wordToReturn = LanguageDBManager.shared.queryVerb(of: verbToConjugate, with: outputCols)[0] potentialWordsToReturn = wordToReturn.components(separatedBy: " ") if inputWordIsCapitalized { - proxy.insertText(wordToReturn.capitalized + getOptionalSpace()) + if controllerLanguage == "English", potentialWordsToReturn.count > 1 { + // Don't return a space as well as we have a perfect verb and the cursor will be between. + proxy.insertText(wordToReturn.capitalize()) + } else { + proxy.insertText(wordToReturn.capitalized + getOptionalSpace()) + } + } else { + proxy.insertText(wordToReturn + getOptionalSpace()) + } + } else if formsDisplayDimensions == .view1x2 { + wordToReturn = LanguageDBManager.shared.queryVerb(of: verbToConjugate, with: outputCols)[0] + potentialWordsToReturn = wordToReturn.components(separatedBy: " ") + + if inputWordIsCapitalized { + if controllerLanguage == "English", potentialWordsToReturn.count > 1 { + // Don't return a space as well as we have a perfect verb and the cursor will be between. + proxy.insertText(wordToReturn.capitalize()) + } else { + proxy.insertText(wordToReturn.capitalized + getOptionalSpace()) + } } else { proxy.insertText(wordToReturn + getOptionalSpace()) } @@ -283,7 +319,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 @@ -336,7 +374,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() @@ -355,7 +395,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() diff --git a/Keyboards/KeyboardsBase/ScribeFunctionality/Plural.swift b/Keyboards/KeyboardsBase/ScribeFunctionality/Plural.swift index 90757025..00068c10 100644 --- a/Keyboards/KeyboardsBase/ScribeFunctionality/Plural.swift +++ b/Keyboards/KeyboardsBase/ScribeFunctionality/Plural.swift @@ -64,7 +64,11 @@ func queryPluralNoun(queriedNoun: String) { proxy.insertText(wordToReturn + getOptionalSpace()) } } else { - proxy.insertText(noun + getOptionalSpace()) + if inputWordIsCapitalized { + proxy.insertText(noun.capitalized + getOptionalSpace()) + } else { + proxy.insertText(noun + getOptionalSpace()) + } commandState = .alreadyPlural } } diff --git a/Keyboards/KeyboardsBase/Utilities.swift b/Keyboards/KeyboardsBase/Utilities.swift index f851d115..549bb96f 100644 --- a/Keyboards/KeyboardsBase/Utilities.swift +++ b/Keyboards/KeyboardsBase/Utilities.swift @@ -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": diff --git a/Keyboards/LanguageKeyboards/English/ENCommandVariables.swift b/Keyboards/LanguageKeyboards/English/ENCommandVariables.swift index 63cf7384..45978224 100644 --- a/Keyboards/LanguageKeyboards/English/ENCommandVariables.swift +++ b/Keyboards/LanguageKeyboards/English/ENCommandVariables.swift @@ -22,23 +22,124 @@ func enSetConjugationLabels() { for k in formLabelsDict.keys { formLabelsDict[k] = "" } + + switch enConjugationState { + case .present, .past, .future, .conditional: + formLabelsDict["TL"] = "Simple" + formLabelsDict["TR"] = "Continuous" + formLabelsDict["BL"] = "Perfect" + formLabelsDict["BR"] = "Perfect Continuous" + case .presSimp, .presPerf, .presPerfCont: + formLabelsDict["Left"] = "I/you/plural" + formLabelsDict["Right"] = "he/she/it" + case .presCont: + formLabelsDict["TL"] = "Participle" + formLabelsDict["TR"] = "I" + formLabelsDict["BL"] = "you/plural" + formLabelsDict["BR"] = "he/she/it" + case .pastCont: + formLabelsDict["Top"] = "Participle" + formLabelsDict["Middle"] = "I/he/she/it" + formLabelsDict["Bottom"] = "you/plural" + } } /// What the conjugation state is for the conjugate feature. enum ENConjugationState { case present + case presSimp + case presCont + case presPerf + case presPerfCont + case past + case pastCont + case future + case conditional } var enConjugationState: ENConjugationState = .present /// Sets the title of the command bar when the keyboard is in conjugate mode. -func enGetConjugationTitle() {} +func enGetConjugationTitle() -> String { + if inputWordIsCapitalized { + verbToDisplay = verbToConjugate.capitalized + } else { + verbToDisplay = verbToConjugate + } + switch enConjugationState { + case .present: + return commandPromptSpacing + "Present: " + verbToDisplay + case .presSimp: + return commandPromptSpacing + "Pr. Simple: " + verbToDisplay + case .presCont: + return commandPromptSpacing + "Pr. Continuous: " + verbToDisplay + case .presPerf: + return commandPromptSpacing + "Pr. Perfect: " + verbToDisplay + case .presPerfCont: + return commandPromptSpacing + "Pr. Perf. Continuous: " + verbToDisplay + case .past: + return commandPromptSpacing + "Past: " + verbToDisplay + case .pastCont: + return commandPromptSpacing + "Past Continuous: " + verbToDisplay + case .future: + return commandPromptSpacing + "Future: " + verbToDisplay + case .conditional: + return commandPromptSpacing + "Conditional: " + verbToDisplay + } +} /// Returns the appropriate key in the verbs dictionary to access conjugations. -func enGetConjugationState() {} +func enGetConjugationState() -> [String] { + switch enConjugationState { + case .present: + return ["presTPS", "presPart", "presPerfTPS", "presPerfTPSCont"] + case .presSimp: + return ["presSimp", "presTPS"] + case .presCont: + return ["presPart", "presFPSCont", "prePluralCont", "presTPSCont"] + case .presPerf: + return ["presPerfSimp", "presPerfTPS"] + case .presPerfCont: + return ["presPerfSimpCont", "presPerfTPSCont"] + case .past: + return ["pastSimp", "presPart", "pastPerf", "pastPerfCont"] + case .pastCont: + return ["presPart", "pastSimpCont", "pastSimpPluralCont"] + case .future: + return ["futSimp", "futCont", "futPerf", "futPerfCont"] + case .conditional: + return ["condSimp", "condCont", "condPerf", "condPerfCont"] + } +} /// Action associated with the left view switch button of the conjugation state. -func enConjugationStateLeft() {} +func enConjugationStateLeft() { + switch enConjugationState { + case .present, .presSimp, .presCont, .presPerf, .presPerfCont, .pastCont: + break + case .past: + conjViewShiftButtonsState = .leftInactive + enConjugationState = .present + case .future: + enConjugationState = .past + case .conditional: + conjViewShiftButtonsState = .bothActive + enConjugationState = .future + } +} /// Action associated with the right view switch button of the conjugation state. -func enConjugationStateRight() {} +func enConjugationStateRight() { + switch enConjugationState { + case .presSimp, .presCont, .presPerf, .presPerfCont, .pastCont, .conditional: + break + case .present: + conjViewShiftButtonsState = .bothActive + enConjugationState = .past + case .past: + enConjugationState = .future + case .future: + conjViewShiftButtonsState = .rightInactive + enConjugationState = .conditional + } +} diff --git a/Keyboards/LanguageKeyboards/English/ENInterfaceVariables.swift b/Keyboards/LanguageKeyboards/English/ENInterfaceVariables.swift index e2294733..839b2897 100644 --- a/Keyboards/LanguageKeyboards/English/ENInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/English/ENInterfaceVariables.swift @@ -160,19 +160,19 @@ func setENKeyboardLayout() { numericAutosuggestions = ["is", "to", "and"] verbsAfterPronounsArray = ["have", "be", "can"] pronounAutosuggestionTenses = [ - "I": "presFPS", - "you": "presSPS", + "I": "presSimp", + "you": "presSimp", "he": "presTPS", "she": "presTPS", "it": "presTPS", - "we": "presFPP", - "they": "presTPP" + "we": "presSimp", + "they": "presSimp" ] translateKeyLbl = "Translate" - translatePrompt = commandPromptSpacing + "en -› \(getControllerLanguageAbbr()): " - translatePromptAndCursor = translatePrompt + commandCursor - translatePromptAndPlaceholder = translatePromptAndCursor + " " + translatePlaceholder + translatePrompt = commandPromptSpacing + "Currently not utilized" // "en -› \(getControllerLanguageAbbr()): " + translatePromptAndCursor = translatePrompt // + commandCursor + translatePromptAndPlaceholder = translatePromptAndCursor // + " " + translatePlaceholder translatePromptAndColorPlaceholder = NSMutableAttributedString(string: translatePromptAndPlaceholder) translatePromptAndColorPlaceholder.setColorForText(textForAttribute: translatePlaceholder, withColor: UIColor(cgColor: commandBarPlaceholderColorCG)) diff --git a/Keyboards/LanguageKeyboards/English/ENLanguageData.sqlite b/Keyboards/LanguageKeyboards/English/ENLanguageData.sqlite new file mode 100644 index 00000000..70de6286 Binary files /dev/null and b/Keyboards/LanguageKeyboards/English/ENLanguageData.sqlite differ diff --git a/Keyboards/LanguageKeyboards/English/English.entitlements b/Keyboards/LanguageKeyboards/English/English.entitlements new file mode 100644 index 00000000..bfc5c2bf --- /dev/null +++ b/Keyboards/LanguageKeyboards/English/English.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.application-groups + + group.be.scri.userDefaultsContainer + + + diff --git a/Keyboards/LanguageKeyboards/French/FRLanguageData.sqlite b/Keyboards/LanguageKeyboards/French/FRLanguageData.sqlite index 371b99a7..e52e8e1b 100644 Binary files a/Keyboards/LanguageKeyboards/French/FRLanguageData.sqlite and b/Keyboards/LanguageKeyboards/French/FRLanguageData.sqlite differ diff --git a/Keyboards/LanguageKeyboards/German/DELanguageData.sqlite b/Keyboards/LanguageKeyboards/German/DELanguageData.sqlite index 00d3533e..ba2a1686 100644 Binary files a/Keyboards/LanguageKeyboards/German/DELanguageData.sqlite and b/Keyboards/LanguageKeyboards/German/DELanguageData.sqlite differ diff --git a/Keyboards/LanguageKeyboards/Italian/ITLanguageData.sqlite b/Keyboards/LanguageKeyboards/Italian/ITLanguageData.sqlite index 5cb5e346..77f0c893 100644 Binary files a/Keyboards/LanguageKeyboards/Italian/ITLanguageData.sqlite and b/Keyboards/LanguageKeyboards/Italian/ITLanguageData.sqlite differ diff --git a/Keyboards/LanguageKeyboards/Portuguese/PTLanguageData.sqlite b/Keyboards/LanguageKeyboards/Portuguese/PTLanguageData.sqlite index bb711367..971750e0 100644 Binary files a/Keyboards/LanguageKeyboards/Portuguese/PTLanguageData.sqlite and b/Keyboards/LanguageKeyboards/Portuguese/PTLanguageData.sqlite differ diff --git a/Keyboards/LanguageKeyboards/Russian/RULanguageData.sqlite b/Keyboards/LanguageKeyboards/Russian/RULanguageData.sqlite index 3c79364e..05cca6a4 100644 Binary files a/Keyboards/LanguageKeyboards/Russian/RULanguageData.sqlite and b/Keyboards/LanguageKeyboards/Russian/RULanguageData.sqlite differ diff --git a/Keyboards/LanguageKeyboards/Spanish/ESLanguageData.sqlite b/Keyboards/LanguageKeyboards/Spanish/ESLanguageData.sqlite index 8c4e07b6..52c71cf7 100644 Binary files a/Keyboards/LanguageKeyboards/Spanish/ESLanguageData.sqlite and b/Keyboards/LanguageKeyboards/Spanish/ESLanguageData.sqlite differ diff --git a/Keyboards/LanguageKeyboards/Swedish/SVLanguageData.sqlite b/Keyboards/LanguageKeyboards/Swedish/SVLanguageData.sqlite index e502a311..1a51208f 100644 Binary files a/Keyboards/LanguageKeyboards/Swedish/SVLanguageData.sqlite and b/Keyboards/LanguageKeyboards/Swedish/SVLanguageData.sqlite differ diff --git a/Scribe.xcodeproj/project.pbxproj b/Scribe.xcodeproj/project.pbxproj index cfb834f4..c3e9be60 100644 --- a/Scribe.xcodeproj/project.pbxproj +++ b/Scribe.xcodeproj/project.pbxproj @@ -101,6 +101,8 @@ 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 */; }; + 5A8FFB6B2C5A9D9C00F4B571 /* English.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = D1AFDF3D29CA66D00033BF27 /* English.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 5A8FFB702C5E5A6F00F4B571 /* ENLanguageData.sqlite in Resources */ = {isa = PBXBuildFile; fileRef = 5A8FFB6E2C5E575B00F4B571 /* ENLanguageData.sqlite */; }; 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 */; }; @@ -753,6 +755,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 */; @@ -835,6 +844,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 */, @@ -880,6 +890,7 @@ 38BD215022D592CA00C6795D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 38DD94F022D6A40000FF8845 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; 5A0A4C2B2C207C34003ADE27 /* Localizable.xcstrings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; + 5A8FFB6E2C5E575B00F4B571 /* ENLanguageData.sqlite */ = {isa = PBXFileReference; lastKnownFileType = file; path = ENLanguageData.sqlite; sourceTree = ""; }; 69B81EBB2BFB8C77008CAB85 /* TipCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TipCardView.swift; sourceTree = ""; }; 84AF4D872C3575EA009AE0D2 /* UIDeviceExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIDeviceExtensions.swift; sourceTree = ""; }; CE1378C228F5D7AC00E1CBC2 /* ScribeColor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScribeColor.swift; sourceTree = ""; }; @@ -978,6 +989,7 @@ D1D8B23B2AE4089C0070B817 /* Italian.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Italian.entitlements; sourceTree = ""; }; D1D8B23C2AE408AC0070B817 /* German.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = German.entitlements; sourceTree = ""; }; D1D8B23D2AE408C50070B817 /* French.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = French.entitlements; sourceTree = ""; }; + D1FF8ED12C6C282500EF50AC /* English.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = English.entitlements; sourceTree = ""; }; ED2486F12B0B4E8C0038AE6A /* AboutTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutTableViewCell.swift; sourceTree = ""; }; ED2486F22B0B4E8C0038AE6A /* AboutTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AboutTableViewCell.xib; sourceTree = ""; }; EDB460202B03B3E400BEA967 /* BaseTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseTableViewController.swift; sourceTree = ""; }; @@ -1418,9 +1430,11 @@ D1AFDE6929CA65740033BF27 /* English */ = { isa = PBXGroup; children = ( + D1FF8ED12C6C282500EF50AC /* English.entitlements */, D1CDED782A859FB600098546 /* ENCommandVariables.swift */, D1CDED7A2A859FBF00098546 /* ENInterfaceVariables.swift */, D1AFDE6A29CA65740033BF27 /* ENKeyboardViewController.swift */, + 5A8FFB6E2C5E575B00F4B571 /* ENLanguageData.sqlite */, D1AFDE6C29CA65740033BF27 /* Info.plist */, ); path = English; @@ -1550,6 +1564,7 @@ D1AFDFC029CA68610033BF27 /* PBXTargetDependency */, D1AFDFC329CA68660033BF27 /* PBXTargetDependency */, D1AFE01529CA6F980033BF27 /* PBXTargetDependency */, + 5A8FFB6D2C5A9D9C00F4B571 /* PBXTargetDependency */, ); name = Scribe; packageProductDependencies = ( @@ -1963,6 +1978,7 @@ files = ( D1AFDF3429CA66D00033BF27 /* Keyboard.xib in Resources */, D1895BD42C1D816F009FBEB0 /* Settings.bundle in Resources */, + 5A8FFB702C5E5A6F00F4B571 /* ENLanguageData.sqlite in Resources */, D1AFDF3729CA66D00033BF27 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2772,6 +2788,11 @@ target = 38BD214B22D592CA00C6795D /* German */; targetProxy = 38BD215122D592CA00C6795D /* PBXContainerItemProxy */; }; + 5A8FFB6D2C5A9D9C00F4B571 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D1AFDF0029CA66D00033BF27 /* English */; + targetProxy = 5A8FFB6C2C5A9D9C00F4B571 /* PBXContainerItemProxy */; + }; D109A211275B6888005E2271 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = D109A20A275B6888005E2271 /* French */; @@ -3447,6 +3468,7 @@ D1AFDF3B29CA66D00033BF27 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = Keyboards/LanguageKeyboards/English/English.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; @@ -3472,6 +3494,7 @@ D1AFDF3C29CA66D00033BF27 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = Keyboards/LanguageKeyboards/English/English.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1;