-
Notifications
You must be signed in to change notification settings - Fork 4
/
mingrelian.py
207 lines (189 loc) · 6.13 KB
/
mingrelian.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
# -*- 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 webapp2
import base
Language = 'Mingrelian'
Language_native = 'მარგალური ნინა'
LanguageCode = 'xmf'
ScriptCode = 'Geor'
encoding_font_list = [
{
'font_path': '/fonts/Georgian/akolkhn.otf',
'font_name': 'akolkhn',
'display_name': 'Akolkhn ASCII',
},
{
'font_path': '/fonts/Georgian/AcadMtavr_new.ttf',
'font_name': 'AcadMtavr',
'display_name': 'AcadMtavr ASCII',
},
{
'font_path': '/fonts/Georgian/LitNusx.otf',
'font_name': 'LitNusx',
'display_name': 'LitNusx ASCII',
},
]
unicode_font_list = [
{
'family': 'NotoSansGeorgianRegular',
'longName': 'Noto Sans Georgian Regular',
'source': '/fonts/Georgian/NotoSansGeorgian-Regular.ttf',
},
{
'family': 'NotoSerifGeorgianRegular',
'longName': 'Noto Serif Georgian',
'source': '/fonts/Georgian/NotoSerifGeorgian-Regular.ttf',
},
{
'family': 'NotoSansGeorgianLight',
'longName': 'Noto Sans Georgian Light',
'source': '/fonts/Georgian/NotoSansGeorgian-Light.ttf',
},
{
'family': 'NotoSerifGeorgianLight',
'longName': 'Noto Serif Georgian Light',
'source': '/fonts/Georgian/NotoSerifGeorgian-Light.ttf',
},
{
'family': 'bpg_glaho',
'longName': 'BPG Glaho',
'source': '/fonts/Georgian/bpg_glaho.ttf',
},
]
links = [
{
'linkText': 'Keyboard',
'ref': '/' + LanguageCode + '/'
},
{
'linkText': 'Convert',
'ref': '/' + LanguageCode + '/convert/'},
{
'linkText': 'Transliterate',
'ref': '/' + LanguageCode + '/translit/'},
{
'linkText': 'KB transforms',
'ref': '/' + LanguageCode + '/kbtransforms/'
},
# {'linkText': 'Font conversion summary',
# 'ref': '/' + LanguageCode + '/encodingRules/'
# },
{'linkText': 'Resources',
'ref': '/' + LanguageCode + '/downloads/'
},
{
'linkText': 'Unicode block',
'ref': 'https://en.wikipedia.org/wiki/Georgian_(Unicode_block)'
},
{
'linkText': 'Omniglot',
'ref': 'https://omniglot.com/writing/mingrelian.htm'
},
# {'linkText': 'Wikipedi page',
# 'ref': 'https://en.wikipedia.org/wiki/Lepcha_language'
# },
# {'linkText': 'Ethnolog',
# 'ref': 'https://www.ethnologue.com/language/lep'
# },
# {'linkText': 'Combiners',
# 'ref': '/lep/diacritic/'
# },
]
class langInfo:
def __init__(self):
self.LanguageCode = LanguageCode
self.Language = Language
self.Language_native = Language_native
self.test_data = u''
self.unicode_font_list = unicode_font_list
self.encoding_font_list = encoding_font_list
self.lang_list = [LanguageCode] # This may be extended
self.kb_list = [
{'shortName': 'xmf_Latn2',
'longName': 'Mingrelian Latin 2',
'instructions': 'Type ʒʒ, kk, pp, tt, zz, çç, ƷƷ, KK \u2026 to add \u02d8 --> ʒ̆ k̆ p̆ t̆ z̆ ç̆ Ʒ̆ K̆ \u2026',
},
{'shortName': 'xmf_Latn',
'longName': 'Mingrelian Latin',
'instructions': 'Type ʒʒ, kk, pp, tt, zz, çç, ƷƷ, KK \u2026 to add \u02d8 --> ʒ̆ k̆ p̆ t̆ z̆ ç̆ Ʒ̆ K̆ \u2026',
},
{'shortName': 'xmf_translit',
'longName': 'Mingrelian translit',
'source': 'https://translit.cc/ge/',
'instructions': "See 'https://translit.cc/ge/'",
},
{'shortName': LanguageCode,
'longName': 'Mingrelian Georgian',
'source': 'GBoard Mingrelian',
'instructions': "Based on GBoard Mingrelian",
},
]
self.links = links
# For Georgian to Latin
self.translit_kb_list = [
{'shortName': LanguageCode,
'longName': 'Mingrelian Georgian',
'source': 'GBoard Mingrelian',
'instructions': "Based on GBoard Mingrelian",
},
{'shortName': 'en',
'longName': 'Latin font encoding',
},
]
self.translit_encoding_list = [
encoding_font_list[0], encoding_font_list[1], encoding_font_list[2],
{
'font_name': 'NotoSansGeorgianRegular',
'display_name': 'Noto Sans Georgian Regular',
'font_path': '/fonts/Georgian/NotoSansGeorgian-Regular.ttf',
},
{
'font_name': 'NotoSerifGeorgianRegular',
'display_name': 'Noto Serif Georgian',
'font_path': '/fonts/Georgian/NotoSerifGeorgian-Regular.ttf',
},
]
# For additional resources for download
self.text_file_list = [
{
'name': 'KeyMan Mingrelian Latin Mobile + desktop',
'source': '/resources/xmf/mingrelian.kmp',
'description': 'Version 1.0 .kmp includes Mobile 4-Dec-2021'
},
]
# TODO: Fill in the rest of the common data.
# TODO: Fill in with diacritics
self.diacritic_list = [unichr(x) for x in range(0x300, 0x330)]
# TODO: Fill in base consonant
self.default_base_consonant = u'\0x61'
self.encodedRanges = [
(0x20, 0xff),
]
# To handle transliteration
self.outputScript = 'Mingrelian Unicode'
langInstance = langInfo()
app = webapp2.WSGIApplication([
('/' + LanguageCode + '/', base.LanguagesHomeHandler),
('/' + LanguageCode + '/convert/', base.ConvertUIHandler), #
('/' + LanguageCode + '/translit/', base.TranslitHandler), # Transliterates to Latin
('/' + langInstance.LanguageCode + '/kbtransforms/', base.KeyboardTransforms),
('/' + LanguageCode + '/downloads/', base.Downloads),
('/' + LanguageCode + '/encodingRules/', base.EncodingRules),
('/' + LanguageCode + '/diacritic/', base.DiacriticHandler),
('/' + LanguageCode + '/kbtransforms/', base.KeyboardTransforms),
], debug=True,
config={'langInfo': langInstance}
)