Update to allow translations from config file. Updates to use translations from config file.

This commit is contained in:
Jordan Ruthe committed 2021-01-03 12:43:53 -05:00
1 parent c08a293f83
commit 3c2bdee22a
7 files changed
+307 -90

No files matched your search

+9
View File
@@ -18,6 +18,7 @@ import subprocess
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib, Pango
from jinja2 import Environment, Template
from ks_includes.KlippyWebsocket import KlippyWebsocket
from ks_includes.KlippyRest import KlippyRest
@@ -440,6 +441,14 @@ class KlipperScreen(Gtk.Window):
{"name":_("Cancel"),"response": Gtk.ResponseType.CANCEL}
]
try:
env = Environment(extensions=["jinja2.ext.i18n"])
env.install_gettext_translations(self.lang)
j2_temp = env.from_string(text)
text = j2_temp.render()
except:
logger.debug("Error parsing jinja for confirm_send_action")
label = Gtk.Label()
label.set_markup(text)
label.set_hexpand(True)