-
Notifications
You must be signed in to change notification settings - Fork 0
/
setting.py
30 lines (26 loc) · 1.36 KB
/
setting.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
import xml.dom.minidom
class LangType():
ENGLISH = "en"
CHINESE = "cn"
class LanguageSetter(object):
def __init__(self, type) -> None:
self.type = type
self.data = self.read(type)
def read(self, type):
if type == LangType.CHINESE:
dom = xml.dom.minidom.parse('res/languages/strings_cn.xml')
elif type == LangType.ENGLISH:
dom = xml.dom.minidom.parse('res/languages/strings.xml')
data = {
'openfile' : dom.getElementsByTagName('openfile')[0].firstChild.data,
'openmorefile' : dom.getElementsByTagName('openmorefile')[0].firstChild.data,
'change_font' : dom.getElementsByTagName('change_font')[0].firstChild.data,
'change_color' : dom.getElementsByTagName('change_color')[0].firstChild.data,
'save_file' : dom.getElementsByTagName('save_file')[0].firstChild.data,
'set_page' : dom.getElementsByTagName('set_page')[0].firstChild.data,
'print_file' : dom.getElementsByTagName('print_file')[0].firstChild.data,
'clear_file' : dom.getElementsByTagName('clear_file')[0].firstChild.data,
'run_file' : dom.getElementsByTagName('run_file')[0].firstChild.data,
'exit_' : dom.getElementsByTagName('exit')[0].firstChild.data
}
return data