Revert "Apply WX_LOCALE change from master branch."

This reverts commit 8e9e1a618b.
This commit is contained in:
Seth Hillbrand 2021-11-03 15:12:37 -07:00
parent 9ab6571b3f
commit 3484334d15
1 changed files with 6 additions and 24 deletions

View File

@ -42,7 +42,6 @@
#include <wx/url.h> #include <wx/url.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <clocale>
using KIGFX::COLOR4D; using KIGFX::COLOR4D;
@ -60,33 +59,16 @@ COLOR4D g_GhostColor;
// When reading/writing files, we need to swtich to setlocale( LC_NUMERIC, "C" ). // When reading/writing files, we need to swtich to setlocale( LC_NUMERIC, "C" ).
// Works fine to read/write files with floating point numbers. // Works fine to read/write files with floating point numbers.
// We can call setlocale( LC_NUMERIC, "C" ) or wxLocale( "C", "C", "C", false ) // We can call setlocale( LC_NUMERIC, "C" ) of wxLocale( "C", "C", "C", false )
// wxWidgets discourage a direct call to setlocale // wxWidgets discourage a direct call to setlocale
// However, for us, calling wxLocale( "C", "C", "C", false ) has a unwanted effect: // However, for us, calling wxLocale( "C", "C", "C", false ) has a unwanted effect:
// The I18N translations are no longer active, because the English dictionary is selected. // The I18N translations are no longer active, because the English dixtionary is selected.
// To read files, this is not a major issues, but the resul can differ // To read files, this is not a major issues, but the resul can differ
// from using setlocale(xx, "C"). // from using setlocale(xx, "C").
// Previouly, we used only setlocale( LC_NUMERIC, "C" ) // Previouly, we called setlocale( LC_NUMERIC, "C" )
// // The old code will be removed when calling wxLocale( "C", "C", "C", false )
// Known issues are // is fully tested, and all issues fixed
// on MSW #define USE_WXLOCALE 1 /* 0 to call setlocale, 1 to call wxLocale */
// using setlocale( LC_NUMERIC, "C" ) generates an alert message in debug mode,
// and this message ("Decimal separator mismatch") must be disabled.
// But calling wxLocale( "C", "C", "C", false ) works fine
// On unix:
// calling wxLocale( "C", "C", "C", false ) breaks env vars containing non ASCII7 chars.
// these env vars return a empty string from wxGetEnv() in many cases, and if such a
// var must be read after calling wxLocale( "C", "C", "C", false ), it looks like empty
//
// So use wxLocale on Windows and setlocale on unix
// set USE_WXLOCALE 0 to use setlocale, 1 to use wxLocale:
#if defined( _WIN32 )
#define USE_WXLOCALE 1
#else
#define USE_WXLOCALE 0
#endif
// On Windows, when using setlocale, a wx alert is generated // On Windows, when using setlocale, a wx alert is generated
// in some cases (reading a bitmap for instance) // in some cases (reading a bitmap for instance)