From 9cc650a4675b8fe8626acc1a004c641cd2e126c4 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Tue, 18 Mar 2025 15:32:23 -0400 Subject: [PATCH] Fix ordering of languages when inserting into DB --- xlit_server.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xlit_server.py b/xlit_server.py index 4d0d632..0866adb 100644 --- a/xlit_server.py +++ b/xlit_server.py @@ -201,8 +201,8 @@ def romanizeHandler(): "mr": "mr", "ta": "ta", "te": "te", - "ml": "ml", "kn": "kn", + "ml": "ml", "or": "or", "gu": "gu", "ur": "ur", @@ -243,6 +243,7 @@ def romanizeHandler(): "awadhi": "awa", "english": "en", } + code2lang = {v:k for k,v in lang2code.items()} rtv = dict() @@ -279,7 +280,7 @@ def romanizeHandler(): rtvJson = jsonify(rtv) rtv["en"] = englishWord - cur.execute("INSERT INTO romanizations VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", tuple(rtv.values())) + cur.execute("INSERT INTO romanizations " + str(tuple([code2lang[val] for val in rtv.keys()])) + " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", tuple(rtv.values())) con.commit() con.close()