From 76401d78a9d2f9d08a69142f0c35e3938c43a611 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 13 Dec 2019 16:53:17 +0100 Subject: [PATCH] Sentry: Add locale (both cura and os) to tags. --- cura/CrashHandler.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cura/CrashHandler.py b/cura/CrashHandler.py index 8812d1b98f..6618b55b22 100644 --- a/cura/CrashHandler.py +++ b/cura/CrashHandler.py @@ -9,6 +9,7 @@ import os import os.path import time import json +import locale from typing import cast from sentry_sdk.hub import Hub @@ -176,8 +177,10 @@ class CrashHandler: try: from UM.Application import Application self.cura_version = Application.getInstance().getVersion() + self.cura_locale = Application.getInstance().getPreferences().getValue("general/language") except: self.cura_version = catalog.i18nc("@label unknown version of Cura", "Unknown") + self.cura_locale = "??_??" crash_info = "" + catalog.i18nc("@label Cura version number", "Cura version") + ": " + str(self.cura_version) + "
" crash_info += "" + catalog.i18nc("@label Type of platform", "Platform") + ": " + str(platform.platform()) + "
" @@ -193,12 +196,16 @@ class CrashHandler: self.data["os"] = {"type": platform.system(), "version": platform.version()} self.data["qt_version"] = QT_VERSION_STR self.data["pyqt_version"] = PYQT_VERSION_STR + self.data["locale_os"] = locale.getlocale(locale.LC_MESSAGES)[0] if hasattr(locale, 'LC_MESSAGES') else locale.getdefaultlocale()[0] + self.data["locale_cura"] = self.cura_locale with configure_scope() as scope: scope.set_tag("qt_version", QT_VERSION_STR) scope.set_tag("pyqt_version", PYQT_VERSION_STR) scope.set_tag("os", platform.system()) scope.set_tag("os_version", platform.version()) + scope.set_tag("locale_os", self.data["locale_os"]) + scope.set_tag("locale_cura", self.cura_locale) scope.set_tag("is_enterprise", ApplicationMetadata.IsEnterpriseVersion) return group