From 877ffc3287c6ef086585efcb0af1e152987334f4 Mon Sep 17 00:00:00 2001 From: James Crook Date: Fri, 6 Mar 2020 12:06:17 +0000 Subject: [PATCH] Bug 2344 - Windows: Generate Support Data shows info/error message re. language --- src/CrashReport.cpp | 4 ++-- src/prefs/GUIPrefs.cpp | 8 ++++++++ src/prefs/GUIPrefs.h | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/CrashReport.cpp b/src/CrashReport.cpp index 7809957b3..d67197731 100644 --- a/src/CrashReport.cpp +++ b/src/CrashReport.cpp @@ -25,7 +25,7 @@ namespace CrashReport { void Generate(wxDebugReport::Context ctx) { wxDebugReportCompress rpt; - rpt.AddAll(ctx); + //rpt.AddAll(ctx); wxFileNameWrapper fn{ FileNames::DataDir(), wxT("audacity.cfg") }; rpt.AddFile(fn.GetFullPath(), _TS("Audacity Configuration")); @@ -34,7 +34,7 @@ void Generate(wxDebugReport::Context ctx) if (ctx == wxDebugReport::Context_Current) { - auto saveLang = GUIPrefs::GetLang(); + auto saveLang = GUIPrefs::GetLangShort(); GUIPrefs::InitLang( wxT("en") ); auto cleanup = finally( [&]{ GUIPrefs::InitLang( saveLang ); } ); diff --git a/src/prefs/GUIPrefs.cpp b/src/prefs/GUIPrefs.cpp index 8d44e4818..db3e73699 100644 --- a/src/prefs/GUIPrefs.cpp +++ b/src/prefs/GUIPrefs.cpp @@ -366,6 +366,14 @@ wxString GUIPrefs::GetLang() return {}; } +wxString GUIPrefs::GetLangShort() +{ + if (sLocale) + return sLocale->GetName(); + else + return {}; +} + int ShowClippingPrefsID() { static int value = wxNewId(); diff --git a/src/prefs/GUIPrefs.h b/src/prefs/GUIPrefs.h index 55365d842..f9be82a07 100644 --- a/src/prefs/GUIPrefs.h +++ b/src/prefs/GUIPrefs.h @@ -52,6 +52,9 @@ class GUIPrefs final : public PrefsPanel // Returns the last language code that was set static wxString GetLang(); + // Returns the last language code that was set + // Unlike GetLang, gives en rather than en_GB or en_US for result. + static wxString GetLangShort(); private: void Populate();