forked from monolith0/Faust-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReadInternationalization.py
33 lines (29 loc) · 1.11 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
import sqlite3
filepointer = open('de-de.lang', "r")
schema = 'de-de'
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 'en-us' != "explain": # Öh WHAT?
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()