Fixed issues with fetching romanizations from DB
This commit is contained in:
@@ -201,8 +201,8 @@ def romanizeHandler():
|
||||
"mr": "mr",
|
||||
"ta": "ta",
|
||||
"te": "te",
|
||||
"kn": "kn",
|
||||
"ml": "ml",
|
||||
"kn": "kn",
|
||||
"or": "or",
|
||||
"gu": "gu",
|
||||
"ur": "ur",
|
||||
@@ -218,6 +218,32 @@ def romanizeHandler():
|
||||
"sd": "sd",
|
||||
"awa": "hi", # Awadhi uses Hindi script
|
||||
}
|
||||
|
||||
lang2code = {
|
||||
"hindi": "hi",
|
||||
"bengali": "bn",
|
||||
"marathi": "mr",
|
||||
"tamil": "ta",
|
||||
"telugu": "te",
|
||||
"malayalam": "ml",
|
||||
"kannada": "kn",
|
||||
"oriya": "or",
|
||||
"gujarati": "gu",
|
||||
"urdu": "ur",
|
||||
"assamese": "as",
|
||||
"punjabi": "pa",
|
||||
"maithili": "mai",
|
||||
"nepali": "ne",
|
||||
"konkani": "gom",
|
||||
"tulu": "tcy",
|
||||
"bhojpuri": "bho",
|
||||
"dogri": "doi",
|
||||
"manipuri": "mni-Mtei",
|
||||
"sindhi": "sd",
|
||||
"awadhi": "awa",
|
||||
"english": "en",
|
||||
}
|
||||
|
||||
rtv = dict()
|
||||
|
||||
data = request.get_json(force=True)
|
||||
@@ -235,10 +261,11 @@ def romanizeHandler():
|
||||
romanizationsDict = []
|
||||
if len(romanizations) > 0:
|
||||
for row in romanizations:
|
||||
row_dict = {columnNames[i]: row[i] for i in range(len(langCodeLookup)+1)} # The '+1' is because of English, which isn't in langCodeLookup
|
||||
row_dict = {lang2code[columnNames[i]]: row[i] for i in range(len(langCodeLookup)+1)} # The '+1' is because of English, which isn't in langCodeLookup
|
||||
romanizationsDict.append(row_dict)
|
||||
json_data = json.dumps(romanizationsdata, indent=4)
|
||||
print(json_data)
|
||||
json_data = jsonify(romanizationsDict[0])
|
||||
con.close()
|
||||
return json_data
|
||||
# if len(romanizations) != 0:
|
||||
|
||||
# Assuming the romanizations didn't exist before
|
||||
|
Reference in New Issue
Block a user