-
Notifications
You must be signed in to change notification settings - Fork 4
/
cree.py
227 lines (207 loc) · 6.83 KB
/
cree.py
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import sys
import webapp2
# Use routines from this base class
import base
# Testing Cree language and variantsn
# Should this be inherited from base.languageTemplate?
class langInfo():
def __init__(self):
self.LanguageCode = 'cr'
self.Language = 'Cree'
self.Language_native = 'Cree languages'
self.encoding_font_list = [
]
self.allFonts = True
self.unicode_font_list = [
{ 'source': '/fonts/cree/NotoSansCanadianAboriginal-Regular.ttf',
'family': 'NotoSansCanadianAboriginal',
'longName': 'Noto Sans Canadian Aboriginal',
},
{ 'source': '/fonts/cree/NotoSansCansPlainsCree.ttf',
'family': 'NotoSansPlainsCree',
'longName': 'Noto Sans Plains Cree',
'information': 'Noto Sans Cans with modified ya, ye, yi, yo shapes'
}, { 'family': 'bjcrus',
'longName': 'BJ Cree',
'source': '/fonts/cree/bjcrus.ttf'
},
{'family': 'oskiblackfoot5',
'longName': 'Oski Blackfoot',
'source': '/fonts/cree/oskiblackfoot5.ttf'
},
{ 'family': 'kisiska',
'longName': 'Kisiska',
'source': '/fonts/cree/kisiska.otf'
},
{ 'family': 'aboriginalSans',
'longName': 'Aboriginal Sans',
'source': '/fonts/cree/AboriginalSansREGULAR.ttf'
},
{'family': 'aboriginalSerif',
'longName': 'Aboriginal Serif',
'source': '/fonts/cree/Aboriginal Serif REGULAR 939.ttf'
},
{'family': 'Euphemia',
'longName': 'Euphemia regular',
'source': '/fonts/cree/Euphemia UCAS Regular 2.6.6.ttf',
'origin': 'http://tiro.com/syllabics/resources/'
},
{'family': 'Uqammaq',
'longName': 'Uqammaq regular',
'source': '/fonts/cree/Uqammaq_Regular.ttf',
'origin': 'http://tiro.com/syllabics/resources/'
},
{'family': 'Pigiarniq',
'longName': 'Pigiarniq regular',
'source': '/fonts/cree/Pigiarniq_Regular.ttf',
'origin': 'http://tiro.com/syllabics/resources/'
},
{'family': 'Masinahikan_h',
'longName': 'Masinahikan',
'source': '/fonts/cree/Masinahikan_h.ttf',
'origin': 'languagegeek.com'
},
{'family': 'Oskiw',
'longName': 'Oskiw',
'source': '/fonts/cree/Oskiw.ttf',
'origin': 'languagegeek.com'
},
{'family': 'Pitabek',
'longName': 'Pitabek',
'source': '/fonts/cree/pitabek.ttf',
'origin': 'languagegeek.com'
},
]
self.lang_list = [
{'shortName': 'crk_phonetic',
'longName': 'ᓀᐦᐃᔭᐍᐏᐣ (Plains Cree)',
'nativeName': 'ᓀᐦᐃᔭᐍᐏᐣ'
},
# {'shortName': 'crk',
# 'longName': 'Plains Cree'
# },
# {'shortName': 'cwd',
# 'longName': 'Woods Cree'
# },
# {'shortName': 'csw',
# 'longName': 'Swampy Cree'
# },
# {'shortName': 'crl',
# 'longName': 'Northern East Cree'
# },
# {'shortName': 'crj',
# 'longName': 'Southern East Cree'
# },
# {'shortName': 'nsk',
# 'longName': 'Naskapi'
# },
# {'shortName': 'moe',
# 'longName': 'Montagnais'
# },
# {'shortName': 'atj',
# 'longName': 'Atikamekw'
# },
]
self.links = [
{'linkText': 'Keyboard',
'ref': '/aho/'
},
{'linkText': 'Converter',
'ref': '/' + self.LanguageCode + '/convertUI/'
},
{'linkText': 'Keyboard transforms',
'ref': '/' + self.LanguageCode + '/kbtransforms/'
},
{'linkText': 'Plains Cree Keyboard',
'ref': 'https://www.altlab.dev/plains-cree-syllabics-key-sequences/'
},
{'linkText': 'Unicode block',
'ref': 'https://www.unicode.org/charts/PDF/U1400.pdf'
},
{'linkText': 'Resources',
'ref': '/' + self.LanguageCode + '/downloads/'
},
{'linkText': 'Language Geek fonts',
'ref': 'http://www.languagegeek.com/font/fontdownload.html'
},
{'linkText': 'Phonetic table',
'ref': '/' + self.LanguageCode + '/phonetickb/'
},
{'linkText': 'Try Plains Cree on Google Input Tools',
'ref': 'https://www.google.com/intl/sa/inputtools/try/'
},
]
# For attaching sorting, etc.
self.text_functions = 'js/cr.js'
self.kb_list = [
{'shortName': 'fort_severn_cree',
'longName': 'Fort Severn Cree',
'nativeName': 'FS ᓀᐦᐃᔭᐍᐏᐣ',
'fontFamily': 'NotoSansCanadianAboriginal',
},
{'shortName': 'james_bay_cree',
'longName': 'James Bay Cree',
'nativeName': 'JB ᓀᐦᐃᔭᐍᐏᐣ',
'fontFamily': 'NotoSansCanadianAboriginal',
},
{'shortName': 'oji_cree',
'longName': 'Oji Cree',
'nativeName': 'OJ ᓀᐦᐃᔭᐍᐏᐣ',
'fontFamily': 'NotoSansCanadianAboriginal',
},
{'shortName': 'crk_phonetic',
'longName': 'Plains Cree Phonetic',
'nativeName': 'ᓀᐦᐃᔭᐍᐏᐣ',
'fontFamily': 'NotoSansCanadianAboriginal',
},
]
# Resource files
self.text_file_list = [
]
self.baseHexUTF16 = u'\u1400'
self.base_consonant = u'\u1400'
if sys.maxunicode >= 0x10000:
self.unicodeChars = [unichr(x) for x in range(0x1400, 0x167F)]
self.diacritic_list = []
else:
self.unicodeChars = [unichr(x) for x in range(0x1400, 0x167F)]
self.diacritic_list = []
self.converters = None
# Python-based transliteration tool.
self.transliterator = None
# Test data for showing in converter.
self.test_data = '' #ᐊ ᐃ ᐄ ᐅ ᐆ ᐊ ᐋ'
return
langInstance = langInfo()
app = webapp2.WSGIApplication(
[
('/cr/', base.LanguagesHomeHandler),
('/cr/keyboard/', base.LanguagesHomeHandler),
('/cr/AllFonts/', base.AllFontTest),
('/cr/convertUI/', base.ConvertUIHandler),
('/cr/downloads/', base.Downloads),
('/cr/converter/', base.ConvertUIHandler),
('/cr/encodingRules/', base.EncodingRules),
('/cr/diacritic/', base.DiacriticHandler),
('/cr/render/', base.EncodingRules),
('/cr/phonetickb/', base.PhoneticKbHandler),
('/' + langInstance.LanguageCode + '/kbtransforms/', base.KeyboardTransforms),
],
debug=True,
config={'langInfo': langInstance}
)