Language plugin translation #361

This commit is contained in:
Jokob-sk
2023-08-17 07:33:48 +10:00
parent 39eb7fff1e
commit f35550663d
5 changed files with 36 additions and 52 deletions

View File

@@ -34,7 +34,7 @@ def update_api(db, isNotification = False, updateOnlyDataSources = []):
["plugins_events", sql_plugins_events],
["plugins_history", sql_plugins_history],
["plugins_objects", sql_plugins_objects],
["language_strings", sql_language_strings],
["plugins_language_strings", sql_language_strings],
["custom_endpoint", conf.API_CUSTOM_SQL],
]

View File

@@ -252,8 +252,16 @@ def importConfigs (db):
conf.mySchedules.append(schedule_class(pref, newSchedule, newSchedule.next(), False))
# Collect settings related language strings
# Creates an entry with key ARPSCAN_CMD_name
collect_lang_strings(db, set, pref + "_" + set["function"])
# Collect column related language strings
for clmn in plugin.get('database_column_definitions', []):
# Creates an entry with key ARPSCAN_Object_PrimaryID_name
collect_lang_strings(db, clmn, pref + "_" + clmn.get("column", ""))
conf.plugins_once_run = False
# -----------------
# Plugins END

View File

@@ -301,6 +301,7 @@ def execute_plugin(db, plugin, pluginsState = plugins_state() ):
sql.executemany ("""INSERT INTO Plugins_History ("Plugin", "Object_PrimaryID", "Object_SecondaryID", "DateTimeCreated", "DateTimeChanged", "Watched_Value1", "Watched_Value2", "Watched_Value3", "Watched_Value4", "Status" ,"Extra", "UserData", "ForeignKey") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", sqlParams)
db.commitDB()
# create objects
pluginsState = process_plugin_events(db, plugin, pluginsState)
# update API endpoints
@@ -532,7 +533,7 @@ def process_plugin_events(db, plugin, pluginsState):
sql.execute ("INSERT INTO Plugins_Events (Plugin, Object_PrimaryID, Object_SecondaryID, DateTimeCreated, DateTimeChanged, Watched_Value1, Watched_Value2, Watched_Value3, Watched_Value4, Status, Extra, UserData, ForeignKey) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)", (plugObj.pluginPref, plugObj.primaryId , plugObj.secondaryId , createdTime, plugObj.changed , plugObj.watched1 , plugObj.watched2 , plugObj.watched3 , plugObj.watched4 , plugObj.status , plugObj.extra, plugObj.userData, plugObj.foreignKey ))
# Perform databse table mapping if enabled for the plugin
# Perform database table mapping if enabled for the plugin
if len(pluginEvents) > 0 and "mapped_to_table" in plugin:
# Initialize an empty list to store SQL parameters.