1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-01 16:19:43 +02:00

Fix for bug 2136

Don't translate doubles in Scripting messages. For valid JSON we need to
retain the dot as decimal separator.
This commit is contained in:
Steve Daulton 2019-06-20 23:16:28 +01:00
parent df14253a50
commit 13ca42638d

View File

@ -32,6 +32,9 @@ capture the more lengthy output from some commands.
#include "../widgets/AudacityMessageBox.h"
#include "../widgets/wxPanelWrapper.h"
#include <locale>
#include <sstream>
void CommandMessageTarget::StartArray()
{
wxString Padding;
@ -78,11 +81,18 @@ void CommandMessageTarget::AddBool(const bool value, const wxString &name){
Update( wxString::Format( "%s\"%s\":\"%s\"", (mCounts.back()>0)?", ":"", name,value?"true":"false"));
mCounts.back() += 1;
}
void CommandMessageTarget::AddItem(const double value, const wxString &name){
std::stringstream str;
std::locale nolocale("");
str.imbue(nolocale);
if( name.empty() )
Update( wxString::Format( "%s%g", (mCounts.back()>0)?", ":"", value));
str << ((mCounts.back()>0)? ", " : "") << value;
else
Update( wxString::Format( "%s\"%s\":%g", (mCounts.back()>0)?", ":"", name,value));
str << ((mCounts.back()>0)? ", " : "") << "\"" << name << "\"" << ":" << value;
Update( str.str() );
mCounts.back() += 1;
}