forked from scribe-org/Scribe-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DEInterfaceVariables.swift
181 lines (159 loc) · 8.05 KB
/
DEInterfaceVariables.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
//
// DEInterfaceVariables.swift
//
// Constants and functions to load the German Scribe keyboard.
//
import UIKit
public enum GermanKeyboardConstants {
// Keyboard key layouts.
static let letterKeysPhone = [
["q", "w", "e", "r", "t", "z", "u", "i", "o", "p", "ü"],
["a", "s", "d", "f", "g", "h", "j", "k", "l", "ö", "ä"],
["shift", "y", "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", "z", "u", "i", "o", "p", "ü"],
["a", "s", "d", "f", "g", "h", "j", "k", "l", "ö", "ä", "return"],
["shift", "y", "x", "c", "v", "b", "n", "m", ",", ".", "ß", "shift"],
["selectKeyboard", ".?123", "space", ".?123", "hideKeyboard"], // "undoArrow"
]
static let numberKeysPad = [
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "+", "delete"],
["\"", "§", "€", "%", "&", "/", "(", ")", "=", "'", "#", "return"],
["#+=", "—", "`", "'", "...", "@", ";", ":", ",", ".", "-", "#+="],
["selectKeyboard", "ABC", "space", "ABC", "hideKeyboard"], // "undoArrow"
]
static let symbolKeysPad = [
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "*", "delete"],
["$", "£", "¥", "¿", "―", "\\", "[", "]", "{", "}", "|", "return"],
["123", "¡", "<", ">", "≠", "·", "^", "~", "!", "?", "_", "123"],
["selectKeyboard", "ABC", "space", "ABC", "hideKeyboard"], // "undoArrow"
]
//added for expanded keyboard
static let letterKeysPadExpanded = [
["^", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "ß", "'", "delete"],
["indent", "q", "w", "e", "r", "t", "z", "u", "i", "o", "p", "ü", "+", "return"],
["uppercase", "a", "s", "d", "f", "g", "h", "j", "k", "l", "ö", "ä", "#", "return"],
["shift", "<", "y", "x", "c", "v", "b", "n", "m", ",", ".", "-", "shift"],
["selectKeyboard", ".?123", "microphone", "space", ".?123", "scribble", "hideKeyboard"], // "undoArrow"
]
//added for symbolKeysPadExpanded
static let symbolKeysPadExpanded = [
["'", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "<", ">", "delete"],
["indent", "[", "]", "{", "}", "#", "%", "^", "*", "+", "=", "\"", "|", "return"],
["undo", "-", "/", ":", ";", "(", ")", "$", "&", "@", "£", "¥", "~", "return"],
["redo", " ", "...", ".", ",", "?", "!", "'", '"', "_", "€"],
["selectKeyboard", ".?123", "microphone", "space", ".?123", "scribble", "hideKeyboard"],
]
// 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 yAlternateKeys = ["ÿ"]
static let sAlternateKeys = ["ß", "ś", "š"]
static let lAlternateKeys = ["ł"]
static let zAlternateKeys = ["ź", "ż"]
static let cAlternateKeys = ["ç", "ć", "č"]
static let nAlternateKeys = ["ń", "ñ"]
}
/// Gets the keys for the German keyboard.
func getDEKeys() {
if DeviceType.isPhone {
letterKeys = GermanKeyboardConstants.letterKeysPhone
numberKeys = GermanKeyboardConstants.numberKeysPhone
symbolKeys = GermanKeyboardConstants.symbolKeysPhone
allKeys = Array(letterKeys.joined()) + Array(numberKeys.joined()) + Array(symbolKeys.joined())
leftKeyChars = ["q", "a", "1", "-", "[", "_"]
rightKeyChars = ["ü", "ä", "0", "\"", "=", "·"]
centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) }
} else {
letterKeys = GermanKeyboardConstants.letterKeysPad
numberKeys = GermanKeyboardConstants.numberKeysPad
symbolKeys = GermanKeyboardConstants.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", "a", "1", "\"", "$"]
// TODO: add "ü" to rightKeyChar if the keyboard has 4 rows.
rightKeyChars = []
centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) }
}
keysWithAlternates = GermanKeyboardConstants.keysWithAlternates
keysWithAlternatesLeft = GermanKeyboardConstants.keysWithAlternatesLeft
keysWithAlternatesRight = GermanKeyboardConstants.keysWithAlternatesRight
aAlternateKeys = GermanKeyboardConstants.aAlternateKeys
eAlternateKeys = GermanKeyboardConstants.eAlternateKeys
iAlternateKeys = GermanKeyboardConstants.iAlternateKeys
oAlternateKeys = GermanKeyboardConstants.oAlternateKeys
uAlternateKeys = GermanKeyboardConstants.uAlternateKeys
yAlternateKeys = GermanKeyboardConstants.yAlternateKeys
sAlternateKeys = GermanKeyboardConstants.sAlternateKeys
lAlternateKeys = GermanKeyboardConstants.lAlternateKeys
zAlternateKeys = GermanKeyboardConstants.zAlternateKeys
cAlternateKeys = GermanKeyboardConstants.cAlternateKeys
nAlternateKeys = GermanKeyboardConstants.nAlternateKeys
}
/// Provides a German keyboard layout.
func setDEKeyboardLayout() {
getDEKeys()
currencySymbol = "€"
currencySymbolAlternates = euroAlternateKeys
spaceBar = "Leerzeichen"
language = "Deutsch"
invalidCommandMsg = "Nicht in Wikidata"
baseAutosuggestions = ["ich", "die", "das"]
numericAutosuggestions = ["Prozent", "Milionen", "Meter"]
verbsAfterPronounsArray = ["haben", "sein", "können"]
pronounAutosuggestionTenses = [
"ich": "presFPS",
"du": "presSPS",
"er": "presTPS",
"sie": "presTPS",
"es": "presTPS",
"wir": "presFPP",
"ihr": "presSPP",
"Sie": "presTPP",
]
translateKeyLbl = "Übersetzen"
translatePlaceholder = "Wort eingeben"
translatePrompt = commandPromptSpacing + "de -› \(getControllerLanguageAbbr()): "
translatePromptAndCursor = translatePrompt + commandCursor
translatePromptAndPlaceholder = translatePromptAndCursor + " " + translatePlaceholder
translatePromptAndColorPlaceholder = NSMutableAttributedString(string: translatePromptAndPlaceholder)
translatePromptAndColorPlaceholder.setColorForText(textForAttribute: translatePlaceholder, withColor: UIColor(cgColor: commandBarBorderColor))
conjugateKeyLbl = "Konjugieren"
conjugatePlaceholder = "Verb eingeben"
conjugatePrompt = commandPromptSpacing + "Konjugieren: "
conjugatePromptAndCursor = conjugatePrompt + commandCursor
conjugatePromptAndPlaceholder = conjugatePromptAndCursor + " " + conjugatePlaceholder
conjugatePromptAndColorPlaceholder = NSMutableAttributedString(string: conjugatePromptAndPlaceholder)
conjugatePromptAndColorPlaceholder.setColorForText(textForAttribute: conjugatePlaceholder, withColor: UIColor(cgColor: commandBarBorderColor))
pluralKeyLbl = "Plural"
pluralPlaceholder = "Nomen eingeben"
pluralPrompt = commandPromptSpacing + "Plural: "
pluralPromptAndCursor = pluralPrompt + commandCursor
pluralPromptAndPlaceholder = pluralPromptAndCursor + " " + pluralPlaceholder
pluralPromptAndColorPlaceholder = NSMutableAttributedString(string: pluralPromptAndPlaceholder)
pluralPromptAndColorPlaceholder.setColorForText(textForAttribute: pluralPlaceholder, withColor: UIColor(cgColor: commandBarBorderColor))
alreadyPluralMsg = "Schon Plural"
}