-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathReadInternationalization.py
35 lines (31 loc) · 1.14 KB
/
ReadInternationalization.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
import sys, sqlite3
filepointer = open(sys.argv[1],"r")
schema = sys.argv[2]
print(sys.argv[1])
print(sys.argv[2])
database_connection = sqlite3.connect('faust_bot.db')
cursor = database_connection.cursor()
cursor.execute('''CREATE TABLE IF NOT EXISTS i18n (ident TEXT , lang TEXT, longText TEXT)''')
cursor.execute('''CREATE TABLE IF NOT EXISTS explain(ident TEXT PRIMARY KEY, longText INT)''')
database_connection.commit()
cursor = database_connection.cursor()
cursor.execute('DELETE FROM i18n WHERE lang = ?', (schema,))
database_connection.commit()
ident = None
long = None
switch = True
cursor = database_connection.cursor()
for line in filepointer:
if(switch):
ident = line.rstrip()
else:
long = line.rstrip()
if schema != "explain":
print("Blatsch")
cursor.execute("INSERT INTO i18n(ident, lang, longText) VALUES(?,?,?)",(ident, schema, long,))
database_connection.commit()
else:
cursor.execute("INSERT INTO explain(ident, longText) VALUES(?,?)", (ident, long,))
database_connection.commit()
switch = False if switch else True
database_connection.close()