Logic Machine Forum
Cleanest way to get current language on older firmwares? - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Cleanest way to get current language on older firmwares? (/showthread.php?tid=4811)



Cleanest way to get current language on older firmwares? - rbourgeon - 06.06.2023

Hello,

disclaimer : I know that with the recently released firmware it's now possible to pass HTTP requests to the LM itself (package "webrequests"), which would probably solve the issue. But my question is about LMs with older firmwares.

My goal is to get, in a Lua script, the current language setting of the LM.

I know that the language is stored in a variable "Config" inside the HTML code of the page scada-main. But to send a HTTP GET request of the page scada-main from a Lua script, it would be necessary to pass admin password in the Lua script, which is not very secure.

Would there be a cleaner way (e.g. io.readfile('path/to/some/file') to get current language setting?


RE: Cleanest way to get current language on older firmwares? - admin - 06.06.2023

Use this:
Code:
lang = require('uci').get('genohm-scada.core.language')
log(lang)

lang will be nil when English is selected.