Skip to content

Commit

Permalink
#33 #7 #133 #134 #135 add layouts for all WIP keyboards
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtavis committed Aug 11, 2023
1 parent 3c16cef commit cd89548
Show file tree
Hide file tree
Showing 30 changed files with 1,020 additions and 393 deletions.
153 changes: 0 additions & 153 deletions Keyboards/KeyboardsBase/InterfaceVariables.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,156 +187,3 @@ var keyPopChar = UILabel()
var keyHoldPopChar = UILabel()
var keyPopLayer = CAShapeLayer()
var keyHoldPopLayer = CAShapeLayer()

// MARK: English Interface Variables

// Note: here only until there is an English keyboard.

public enum EnglishKeyboardConstants {
// Keyboard key layouts.
static let letterKeysPhone = [
["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
["a", "s", "d", "f", "g", "h", "j", "k", "l"],
["shift", "z", "x", "c", "v", "b", "n", "m", "delete"],
["123", "selectKeyboard", "space", "return"], // "undoArrow"
]

static let numberKeysPhone = [
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"],
["-", "/", ":", ";", "(", ")", "$", "&", "@", "\""],
["#+=", ".", ",", "?", "!", "'", "delete"],
["ABC", "selectKeyboard", "space", "return"], // "undoArrow"
]

static let symbolKeysPhone = [
["[", "]", "{", "}", "#", "%", "^", "*", "+", "="],
["_", "\\", "|", "~", "<", ">", "", "£", "¥", "·"],
["123", ".", ",", "?", "!", "'", "delete"],
["ABC", "selectKeyboard", "space", "return"], // "undoArrow"
]

static let letterKeysPad = [
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "delete"],
["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
["a", "s", "d", "f", "g", "h", "j", "k", "l", "return"],
["shift", "w", "x", "c", "v", "b", "n", "m", ",", ".", "shift"],
[".?123", "selectKeyboard", "space", ".?123", "hideKeyboard"], // "undoArrow"
]

static let numberKeysPad = [
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "delete"],
["@", "#", "$", "&", "*", "(", ")", "'", "\"", "return"],
["#+=", "%", "_", "+", "=", "/", ";", ":", ",", ".", "#+="],
["ABC", "selectKeyboard", "space", "ABC", "hideKeyboard"], // "undoArrow"
]

static let symbolKeysPad = [
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "delete"],
["", "£", "¥", "_", "^", "[", "]", "{", "}", "return"],
["123", "§", "|", "~", "...", "\\", "<", ">", "!", "?", "123"],
["ABC", "selectKeyboard", "space", "ABC", "hideKeyboard"], // "undoArrow"
]

// Alternate key vars.
static let keysWithAlternates = ["a", "e", "i", "o", "u", "y", "s", "l", "z", "c", "n"]
static let keysWithAlternatesLeft = ["a", "e", "y", "s", "z", "c"]
static let keysWithAlternatesRight = ["i", "o", "u", "l", "n"]

static let aAlternateKeys = ["à", "á", "â", "ä", "æ", "ã", "å", "ā"]
static let eAlternateKeys = ["è", "é", "ê", "ë", "ē", "ė", "ę"]
static let iAlternateKeys = ["ì", "į", "ī", "í", "ï", "î"]
static let oAlternateKeys = ["õ", "ō", "ø", "œ", "ó", "ò", "ö", "ô"]
static let uAlternateKeys = ["ū", "ú", "ù", "ü", "û"]
static let sAlternateKeys = ["ś", "š"]
static let lAlternateKeys = ["ł"]
static let zAlternateKeys = ["ž", "ź", "ż"]
static let cAlternateKeys = ["ç", "ć", "č"]
static let nAlternateKeys = ["ń", "ñ"]
}

/// Gets the keys for the English keyboard.
func getENKeys() {
if DeviceType.isPhone {
letterKeys = EnglishKeyboardConstants.letterKeysPhone
numberKeys = EnglishKeyboardConstants.numberKeysPhone
symbolKeys = EnglishKeyboardConstants.symbolKeysPhone
allKeys = Array(letterKeys.joined()) + Array(numberKeys.joined()) + Array(symbolKeys.joined())

leftKeyChars = ["q", "1", "-", "[", "_"]
rightKeyChars = ["p", "0", "\"", "=", "·"]
centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) }
} else {
letterKeys = EnglishKeyboardConstants.letterKeysPad
numberKeys = EnglishKeyboardConstants.numberKeysPad
symbolKeys = EnglishKeyboardConstants.symbolKeysPad

// If the iPad is too small to have a numbers row.
letterKeys.removeFirst(1)
letterKeys[0].append("delete")

allKeys = Array(letterKeys.joined()) + Array(numberKeys.joined()) + Array(symbolKeys.joined())

leftKeyChars = ["q", "1"]
// TODO: add "p" to rightKeyChar if the keyboard has 4 rows.
rightKeyChars = []
centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) }
}

keysWithAlternates = EnglishKeyboardConstants.keysWithAlternates
keysWithAlternatesLeft = EnglishKeyboardConstants.keysWithAlternatesLeft
keysWithAlternatesRight = EnglishKeyboardConstants.keysWithAlternatesRight
aAlternateKeys = EnglishKeyboardConstants.aAlternateKeys
eAlternateKeys = EnglishKeyboardConstants.eAlternateKeys
iAlternateKeys = EnglishKeyboardConstants.iAlternateKeys
oAlternateKeys = EnglishKeyboardConstants.oAlternateKeys
uAlternateKeys = EnglishKeyboardConstants.uAlternateKeys
sAlternateKeys = EnglishKeyboardConstants.sAlternateKeys
lAlternateKeys = EnglishKeyboardConstants.lAlternateKeys
zAlternateKeys = EnglishKeyboardConstants.zAlternateKeys
cAlternateKeys = EnglishKeyboardConstants.cAlternateKeys
nAlternateKeys = EnglishKeyboardConstants.nAlternateKeys
}

/// Provides an English keyboard layout.
func setENKeyboardLayout() {
getENKeys()

currencySymbol = "$"
currencySymbolAlternates = dollarAlternateKeys
spaceBar = "space"
invalidCommandMsg = "Not in Wikidata"
baseAutosuggestions = ["I", "I'm", "we"]
numericAutosuggestions = ["is", "to", "and"]
verbsAfterPronounsArray = ["have", "be", "can"]
pronounAutosuggestionTenses = [
"I": "presFPS",
"you": "presSPS",
"he": "presTPS",
"she": "presTPS",
"it": "presTPS",
"we": "presFPP",
"they": "presTPP",
]

translateKeyLbl = "Translate"
translatePrompt = commandPromptSpacing + "en -› \(getControllerLanguageAbbr()): "
translatePromptAndCursor = translatePrompt + commandCursor
translatePromptAndPlaceholder = translatePromptAndCursor + " " + translatePlaceholder
translatePromptAndColorPlaceholder = NSMutableAttributedString(string: translatePromptAndPlaceholder)
translatePromptAndColorPlaceholder.setColorForText(textForAttribute: translatePlaceholder, withColor: UIColor(cgColor: commandBarBorderColor))

conjugateKeyLbl = "Conjugate"
conjugatePrompt = commandPromptSpacing + "Conjugate: "
conjugatePromptAndCursor = conjugatePrompt + commandCursor
conjugatePromptAndPlaceholder = conjugatePromptAndCursor + " " + conjugatePlaceholder
conjugatePromptAndColorPlaceholder = NSMutableAttributedString(string: conjugatePromptAndPlaceholder)
conjugatePromptAndColorPlaceholder.setColorForText(textForAttribute: conjugatePlaceholder, withColor: UIColor(cgColor: commandBarBorderColor))

pluralKeyLbl = "Plural"
pluralPrompt = commandPromptSpacing + "Plural: "
pluralPromptAndCursor = pluralPrompt + commandCursor
pluralPromptAndPlaceholder = pluralPromptAndCursor + " " + pluralPlaceholder
pluralPromptAndColorPlaceholder = NSMutableAttributedString(string: pluralPromptAndPlaceholder)
pluralPromptAndColorPlaceholder.setColorForText(textForAttribute: pluralPlaceholder, withColor: UIColor(cgColor: commandBarBorderColor))
alreadyPluralMsg = "Already plural"
}
31 changes: 31 additions & 0 deletions Keyboards/LanguageKeyboards/Danish/DACommandVariables.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// DACommandVariables.swift
//
// Variables associated with commands for the Danish Scribe keyboard.
//

func daSetConjugationLabels() {
// Reset all form labels prior to assignment.
for k in formLabelsDict.keys {
formLabelsDict[k] = ""
}
}

/// What the conjugation state is for the conjugate feature.
enum DAConjugationState {
case present
}

var daConjugationState: DAConjugationState = .present

/// Sets the title of the command bar when the keyboard is in conjugate mode.
func daGetConjugationTitle() {}

/// Returns the appropriate key in the verbs dictionary to access conjugations.
func daGetConjugationState() {}

/// Action associated with the left view switch button of the conjugation state.
func daConjugationStateLeft() {}

/// Action associated with the right view switch button of the conjugation state.
func daConjugationStateRight() {}
95 changes: 95 additions & 0 deletions Keyboards/LanguageKeyboards/Danish/DAInterfaceVariables.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
//
// DAInterfaceVariables.swift
//
// Constants and functions to load the Danish Scribe keyboard.
//

import UIKit

public enum DanishKeyboardConstants {
// iPhone keyboard layouts.
static let letterKeysPhone = [
["q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "å"],
["a", "s", "d", "f", "g", "h", "j", "k", "l", "æ", "ø"],
["shift", "z", "x", "c", "v", "b", "n", "m", "delete"],
["123", "selectKeyboard", "space", "return"], // "undo"
]

static let numberKeysPhone = [
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"],
["-", "/", ":", ";", "(", ")", "", "&", "@", "\""],
["#+=", ".", ",", "?", "!", "'", "delete"],
["ABC", "selectKeyboard", "space", "return"], // "undo"
]

static let symbolKeysPhone = [
["[", "]", "{", "}", "#", "%", "^", "*", "+", "="],
["_", "\\", "|", "~", "<", ">", "", "£", "¥", "·"],
["123", ".", ",", "?", "!", "'", "delete"],
["ABC", "selectKeyboard", "space", "return"], // "undo"
]

// iPad keyboard layouts.
static let letterKeysPad = [
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "+"],
["q", "w", "e", "r", "t", "y", "u", "i", "o", "æ", "ø", "delete"],
["a", "s", "d", "f", "g", "h", "j", "k", "l", "ö", "ä", "return"],
["shift", "z", "x", "c", "v", "b", "n", "m", ",", ".", "-", "shift"],
["selectKeyboard", ".?123", "space", ".?123", "hideKeyboard"], // "undo"
]

static let numberKeysPad = [
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "`", "delete"],
["@", "#", "kr", "&", "*", "(", ")", "'", "\"", "+", "·", "return"],
["#+=", "%", "_", "-", "=", "/", ";", ":", ",", ".", "?", "#+="],
["selectKeyboard", "ABC", "space", "ABC", "hideKeyboard"], // "undo"
]

static let symbolKeysPad = [
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "'", "delete"],
["", "$", "£", "^", "[", "]", "{", "}", "", "", "...", "return"],
["123", "§", "|", "~", "", "", "\\", "<", ">", "!", "?", "123"],
["selectKeyboard", "ABC", "space", "ABC", "hideKeyboard"], // "undo"
]

// Expanded iPad keyboard layouts for wider devices.
static let letterKeysPadExpanded = [
["$", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "+", "'", "delete"],
["indent", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "å", "@", "*"],
["uppercase", "a", "s", "d", "f", "g", "h", "j", "k", "l", "æ", "ø", "'", "return"],
["shift", "<", "z", "x", "c", "v", "b", "n", "m", ",", ".", "-", "shift"],
["selectKeyboard", ".?123", "space", ".?123", "hideKeyboard"], // "microphone", "scribble"
]

static let symbolKeysPadExpanded = [
["`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "<", ">", "delete"],
["indent", "[", "]", "{", "}", "#", "%", "^", "*", "+", "=", "\"", "|"],
["uppercase", "-", "/", ":", ";", "(", ")", "$", "&", "@", "£", "¥", "~", "return"], // "undo"
["shift", "...", ".", ",", "?", "!", "'", "\"", "_", ""], // "redo"
["selectKeyboard", "ABC", "space", "ABC", "hideKeyboard"], // "microphone", "scribble"
]

// Alternate key vars.
static let keysWithAlternates = ["a", "e", "i", "o", "u", "y", "æ", "ø", "d", "l", "n", "s"]
static let keysWithAlternatesLeft = ["a", "e", "y", "d", "s"]
static let keysWithAlternatesRight = ["i", "o", "u", "æ", "ø", "l", "n"]

static let aAlternateKeys = ["á", "ä", "à", "â", "ã", "ā"]
static let eAlternateKeys = ["é", "ë"]
static let iAlternateKeys = ["ï", "í"]
static let oAlternateKeys = ["ö", "ō", "œ", "õ", "ø", "ò", "ô", "ó"]
static let uAlternateKeys = ["ū", "ù", "û", "ü", "ú"]
static let yAlternateKeys = ["ÿ"]
static let æAlternateKeys = ["ä"]
static let øAlternateKeys = ["ö"]
static let dAlternateKeys = ["ð"]
static let lAlternateKeys = ["ł"]
static let nAlternateKeys = ["ń", "ñ"]
static let sAlternateKeys = ["ß", "ś", "š"]
}

/// Gets the keys for the Danish keyboard.
func getDAKeys() {}

/// Provides the Danish keyboard layout.
func setDAKeyboardLayout() {}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//
// KeyboardViewController.swift
// DAKeyboardViewController.swift
//

class DAKeyboardViewController: KeyboardViewController {}
31 changes: 31 additions & 0 deletions Keyboards/LanguageKeyboards/English/ENCommandVariables.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// ENCommandVariables.swift
//
// Variables associated with commands for the English Scribe keyboard.
//

func enSetConjugationLabels() {
// Reset all form labels prior to assignment.
for k in formLabelsDict.keys {
formLabelsDict[k] = ""
}
}

/// What the conjugation state is for the conjugate feature.
enum ENConjugationState {
case present
}

var enConjugationState: ENConjugationState = .present

/// Sets the title of the command bar when the keyboard is in conjugate mode.
func enGetConjugationTitle() {}

/// Returns the appropriate key in the verbs dictionary to access conjugations.
func enGetConjugationState() {}

/// Action associated with the left view switch button of the conjugation state.
func enConjugationStateLeft() {}

/// Action associated with the right view switch button of the conjugation state.
func enConjugationStateRight() {}
Loading

0 comments on commit cd89548

Please sign in to comment.