Translation preparation and some webgui code

This commit is contained in:
2025-05-15 09:14:14 +02:00
parent fb93c83388
commit 1f2af40943
7 changed files with 131 additions and 9 deletions
+6 -2
View File
@@ -14,6 +14,7 @@ Configuration file located at ~/.config/ymsgui.conf:
import os
import sys
import locale
import gettext
import configparser
import gi
@@ -89,9 +90,12 @@ def messagebox(messagetext, symbol=None, title=None, parent=None):
if __name__ == "__main__":
locale.setlocale(locale.LC_ALL, '')
gettext.bindtextdomain('ymsgui', 'locale')
gettext.textdomain('ymsgui')
_ = gettext.gettext
config = configparser.ConfigParser()
if not config.read(os.path.expanduser(cfg['cfgfile'])):
messagebox("Configuration file not found", title="YMS")
messagebox(_("Configuration file not found"), title="YMS")
else:
cfg['host'] = config.get('DB', 'host')
cfg['db'] = config.get('DB', 'db')
@@ -103,6 +107,6 @@ if __name__ == "__main__":
app.run()
db.disconnect()
else:
messagebox("Database connection cannot be established", title="YMS")
messagebox(_("Database connection cannot be established"), title="YMS")
# Another fine product of the sirius cybernetics corporation