Add C number format option (disabled)

The option to force decimal point in numbers and not
use comma is an experiment to work around bug 2709

It's disabled, because wxWidgets checks for a mismatch
between locale and number format, and disallows it.  To get
it working correctly might require patching wxWidgets.

This change does get the option string into our source code
so that translators can translate it.
This commit is contained in:
James Crook 2021-03-30 15:46:27 +01:00
parent 5495f7ca17
commit 1f1f1d43f6
4 changed files with 24 additions and 0 deletions

View File

@ -46,6 +46,10 @@
// JKC (effect by Norm C, 02 Oct 2013)
#define EXPERIMENTAL_SCIENCE_FILTERS
// JKC an experiement to work around bug 2709
// disabled.
//define EXPERIMENTAL_CEE_NUMBERS_OPTION
// LLL, 01 Oct 2013:
// NEW key assignment view for preferences
#define EXPERIMENTAL_KEY_VIEW

View File

@ -124,6 +124,13 @@ void Internat::Init()
}
}
void Internat::SetCeeNumberFormat()
{
wxSetlocale( LC_NUMERIC, "C" );
mDecimalSeparator = '.';
}
wxChar Internat::GetDecimalSeparator()
{
return mDecimalSeparator;

View File

@ -116,6 +116,7 @@ public:
* Normally, this is a decimal point ('.'), but e.g. Germany uses a
* comma (',').*/
static wxChar GetDecimalSeparator();
static void SetCeeNumberFormat();
/** \brief Convert a string to a number.
*

View File

@ -209,6 +209,11 @@ void GUIPrefs::PopulateOrExchange(ShuttleGui & S)
S.TieCheckBox(XXO("Use mostly Left-to-Right layouts in RTL languages"),
{"/GUI/RtlWorkaround",
true});
#endif
#ifdef EXPERIMENTAL_CEE_NUMBERS_OPTION
S.TieCheckBox(XXO("Never use comma as decimal point"),
{wxT("/Locale/CeeNumberFormat"),
false});
#endif
}
S.EndStatic();
@ -317,6 +322,13 @@ wxString GUIPrefs::SetLang( const wxString & lang )
Internat::Init();
#ifdef EXPERIMENTAL_CEE_NUMBERS_OPTION
bool forceCeeNumbers;
gPrefs->Read(wxT("/Locale/CeeNumberFormat"), &forceCeeNumbers, false);
if( forceCeeNumbers )
Internat::SetCeeNumberFormat();
#endif
// Unused strings that we want to be translated, even though
// we're not using them yet...
using future1 = decltype( XO("Master Gain Control") );