Skip to content

Commit fa1db76

Browse files
committed
fix: broken integers and floats after locale formatting on macOS
Refs #2366
1 parent 7f8dc30 commit fa1db76

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

heidisql.lpr

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33
{$mode delphi}{$H+}
44

55
uses
6-
{$IFDEF UNIX}
7-
cthreads,
8-
{$ENDIF}
9-
{$IFDEF HASAMIGA}
10-
athreads,
11-
{$ENDIF}
6+
{$IFDEF UNIX} cthreads, {$ENDIF}
7+
{$IFDEF DARWIN} iosxlocale, {$ENDIF}
128
Interfaces, // this includes the LCL widgetset
139
SysUtils, Dialogs,
1410
Forms, printer4lazarus, datetimectrls, LCLTranslator, Translations,
@@ -29,12 +25,21 @@
2925
DefaultFormatSettings.TimeSeparator := ':';
3026
DefaultFormatSettings.ShortDateFormat := 'yyyy/mm/dd';
3127
DefaultFormatSettings.LongTimeFormat := 'hh:nn:ss';
28+
3229
// Issue #2189 and #2325:
3330
// Auto-replace French and Russian non-breaking white space, broken through the Char type
3431
// DefaultFormatSettings.ThousandSeparator:= #160;
3532
if DefaultFormatSettings.ThousandSeparator in [#226, #160] then
3633
DefaultFormatSettings.ThousandSeparator := ' ';
3734

35+
// Issue #2366:
36+
// https://wiki.freepascal.org/Locale_settings_for_macOS
37+
// On macOS, initializing locale settings through iosxlocale mostly does not work, so we do it hardcoded here:
38+
if DefaultFormatSettings.DecimalSeparator = #0 then
39+
DefaultFormatSettings.DecimalSeparator := '.';
40+
if DefaultFormatSettings.ThousandSeparator = #0 then
41+
DefaultFormatSettings.ThousandSeparator := ' ';
42+
3843
AppSettings := TAppSettings.Create;
3944

4045
AppLanguage := AppSettings.ReadString(asAppLanguage);

0 commit comments

Comments
 (0)