-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbangali.py
163 lines (149 loc) · 4.65 KB
/
bangali.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
# -*- 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 base
# import transliterate
# import transrule_ccp
import json
import logging
import os
import sys
import urllib
import webapp2
from google.appengine.ext.webapp import template
encoding_font_list = [
# {
# 'font_path':'/fonts/bete/JGBete4PUA.ttf',
# 'font_name':'JGBete4',
# 'display_name': 'JGBete4',
# # 'Source location': 'https://www.wfonts.com/font/jg-bete', # ??
# },
]
unicode_font_list = [
{
'family': 'NotoSansBengali',
'longName': 'Noto Sans Bengali',
'source': '/fonts/NotoSansBengali-Regular.ttf',
'attribution': 'https://www.wfonts.com/font/jg-bete',
},
{
'family': 'Hindia',
'longName': 'Hindia',
'source': '/fonts/SouthAsia/Hindia.otf',
'attribution': 'https://www.wfonts.com/category/various',
},
{
'family': 'Nirmala',
'longName': 'Nirmala',
'source': '/fonts/SouthAsia/Nirmala.ttf',
'attribution': 'https://www.wfonts.com/category/various',
},
{
'family': 'SolaimanLipi_2-2012' ,
'longName': 'SolaimanLipi 2012',
'source': '/fonts/SouthAsia/SolaimanLipi_22-02-2012.ttf',
'attribution': 'https://www.wfonts.com/category/various',
},
{
'family': 'SolaimanLipi_2006',
'longName': 'SolaimanLipi 2006',
'source': '/fonts/SouthAsia/SolaimanLipi_29-05-06.ttf',
'attribution': 'https://www.wfonts.com/category/various',
},
{
'family': 'SolaimanLipi_Bold',
'longName': 'SolaimanLipi Bold',
'source': '/fonts/SouthAsia/SolaimanLipi_Bold_10-03-12.ttf',
'attribution': 'https://www.wfonts.com/category/various',
},
]
links = [
{'linkText': 'Keyboard',
'ref': '/bn/'
},
# {'linkText': 'Converter',
# 'ref': '/bete/convertUI/'
# },
# {'linkText': 'Font conversion summary',
# 'ref': '/bete/encodingRules/'
# },
# {'linkText': 'Resources',
# 'ref': '/bete/downloads/'
# },
{'linkText': 'Unicode Page',
'ref': 'https://unicode.org/charts/PDF/U0980.pdf'
},
{'linkText': 'Bangali Wikipedia',
'ref': 'https://en.wikipedia.org/wiki/Bangali_(ethnic_dialect)'
},
{
'linkText': 'Combiners',
'ref': '/bn/diacritic/'
},
]
class langInfo():
def __init__(self):
self.LanguageCode = 'bn'
self.Language = u'Bangali'
self.Language_native = u'Bangali'
self.direction = 'ltr'
self.diacritic_list = [unichr(x) for x in range(0x9bc, 0x9e3)]
self.base_consonant = u'ক' # KA
self.baseHexUTF16 = u'\u0995'
self.lang_list = [
{ 'shortName': self.LanguageCode,
'longName': self.Language,
}
]
self.encoding_font_list = encoding_font_list
self.kb_list = [
{
'shortName': 'bn_b2',
'longName': 'Bangali',
'jsName': 'bn_b2',
'instructions': None,
'font': '/fonts/NotoSansBengali-Regular.ttf',
},
# {
# 'shortName': 'bn_b3',
# 'longName': 'Bangali 3',
# 'jsName': 'bn_b3',
# 'instructions': None,
# 'font': '/fonts/NotoSansBengali-Regular.ttf',
# },
]
self.links = links
self.text_file_list = []
self.unicode_font_list = unicode_font_list
# Lists of test characters for the various encodings
self.test_chars = ' '.join([unichr(x) for x in range(0xe9bc, 0x9e3)])
# For dictionary
self.dictionaryLang1 = "English"
self.dictionaryLang2 = self.Language
self.kb1 = 'en'
self.kb2 = self.kb_list[0]['shortName']
# Global in this file.
langInstance = langInfo()
app = webapp2.WSGIApplication(
[('/' + langInstance.LanguageCode+ '/', base.LanguagesHomeHandler),
('/' + langInstance.LanguageCode + '/convertUI/', base.ConvertUIHandler),
('/' + langInstance.LanguageCode+ '/downloads/', base.Downloads),
('/' + langInstance.LanguageCode+ '/converter/', base.ConvertHandler),
('/' + langInstance.LanguageCode+ '/encodingRules/', base.EncodingRules),
('/' + langInstance.LanguageCode+ '/diacritic/', base.DiacriticHandler),
('/' + langInstance.LanguageCode + '/dictionaryInput/', base.DictionaryInput),
], debug=True,
config={'langInfo': langInstance}
)