-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathCommandVariables.swift
160 lines (138 loc) · 4.72 KB
/
CommandVariables.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
//
// CommandVariables.swift
//
// Variables associated with Scribe commands.
//
// A larger vertical bar than the normal | key for the cursor.
let previewCursor: String = "│"
var previewPromptSpacing: String = ""
var previewState: Bool! = false
var invalidState: Bool! = false
// Translate, conjugate, and plural variables.
let translatePrompt: String = previewPromptSpacing + "Translate: "
let translatePromptAndCursor: String = translatePrompt + previewCursor
var getTranslation: Bool = false
let conjugatePrompt: String = previewPromptSpacing + "Conjugate: "
let conjugatePromptAndCursor: String = conjugatePrompt + previewCursor
var getConjugation: Bool = false
var conjugateView: Bool = false
var tenseFPS: String = ""
var tenseSPS: String = ""
var tenseTPS: String = ""
var tenseFPP: String = ""
var tenseSPP: String = ""
var tenseTPP: String = ""
let languagesWithCapitalizedNouns = ["German"]
var verbToConjugate: String = ""
var verbConjugated: String = ""
let pluralPrompt: String = previewPromptSpacing + "Plural: "
let pluralPromptAndCursor: String = pluralPrompt + previewCursor
var getPlural: Bool = false
var isAlreadyPluralState: Bool = false
let allPrompts: [String] = [translatePromptAndCursor, conjugatePromptAndCursor, pluralPromptAndCursor]
// MARK: German conjugation command variables
/// What the conjugation state is for the conjugate feature.
enum DEConjugationState {
case indicativePresent
case indicativePreterite
case indicativePerfect
}
var deConjugationState: DEConjugationState = .indicativePresent
/// Sets the title of the preview bar when the keyboard is in conjugate mode.
func deGetConjugationTitle() -> String {
switch deConjugationState {
case .indicativePresent:
return previewPromptSpacing + "Präsens: " + verbToConjugate
case .indicativePreterite:
return previewPromptSpacing + "Präteritum: " + verbToConjugate
case .indicativePerfect:
return previewPromptSpacing + "Perfekt: " + verbToConjugate
}
}
/// Returns the appropriate key in the verbs dictionary to access conjugations.
func deGetConjugationState() -> String {
switch deConjugationState {
case .indicativePresent:
return "indicativePresent"
case .indicativePreterite:
return "indicativePreterite"
case .indicativePerfect:
return "indicativePerfect"
}
}
/// Action associated with the left view switch button of the conjugation state.
func deConjugationStateLeft() {
if deConjugationState == .indicativePresent {
return
} else if deConjugationState == .indicativePreterite {
deConjugationState = .indicativePresent
return
} else if deConjugationState == .indicativePerfect {
deConjugationState = .indicativePreterite
return
}
}
/// Action associated with the right view switch button of the conjugation state.
func deConjugationStateRight() {
if deConjugationState == .indicativePresent {
deConjugationState = .indicativePreterite
} else if deConjugationState == .indicativePreterite {
deConjugationState = .indicativePerfect
return
} else if deConjugationState == .indicativePerfect {
return
}
}
// MARK: Spanish conjugation command variables
/// What the conjugation state is for the conjugate feature.
enum ESConjugationState {
case indicativePresent
case preterite
case imperfect
}
var esConjugationState: ESConjugationState = .indicativePresent
/// Sets the title of the preview bar when the keyboard is in conjugate mode.
func esGetConjugationTitle() -> String {
switch esConjugationState {
case .indicativePresent:
return previewPromptSpacing + "Presente: " + verbToConjugate
case .preterite:
return previewPromptSpacing + "Pretérito: " + verbToConjugate
case .imperfect:
return previewPromptSpacing + "Imperfecto: " + verbToConjugate
}
}
/// Returns the appropriate key in the verbs dictionary to access conjugations.
func esGetConjugationState() -> String {
switch esConjugationState {
case .indicativePresent:
return "indicativePresent"
case .preterite:
return "preterite"
case .imperfect:
return "imperfect"
}
}
/// Action associated with the left view switch button of the conjugation state.
func esConjugationStateLeft() {
if esConjugationState == .indicativePresent {
return
} else if esConjugationState == .preterite {
esConjugationState = .indicativePresent
return
} else if esConjugationState == .imperfect {
esConjugationState = .preterite
return
}
}
/// Action associated with the right view switch button of the conjugation state.
func esConjugationStateRight() {
if esConjugationState == .indicativePresent {
esConjugationState = .preterite
} else if esConjugationState == .preterite {
esConjugationState = .imperfect
return
} else if esConjugationState == .imperfect {
return
}
}