* Removed navigator reference

This commit is contained in:
michael 2020-12-11 21:28:46 +00:00
parent e06502aa4b
commit e998fe474a

View File

@ -58,7 +58,7 @@ type
{ TFormatSettings } { TFormatSettings }
TFormatSettings = record TFormatSettings = record
strict private strict private
class function GetBrowserLocale: string; assembler; static; class function GetJSLocale: string; assembler; static;
class function GetLocaleShortDayName(const ADayOfWeek: Integer; const ALocale: string): string; static; class function GetLocaleShortDayName(const ADayOfWeek: Integer; const ALocale: string): string; static;
class function GetLocaleDecimalSeparator(const ALocale: string): string; static; class function GetLocaleDecimalSeparator(const ALocale: string): string; static;
class function GetLocaleLongMonthName(const AMonth: Integer; const ALocale: string): string; static; class function GetLocaleLongMonthName(const AMonth: Integer; const ALocale: string): string; static;
@ -86,9 +86,9 @@ type
TimeSeparator: Char; TimeSeparator: Char;
TwoDigitYearCenturyWindow: Word; TwoDigitYearCenturyWindow: Word;
public public
// Type Type
// TLocaleInitCallback = Procedure(aLocale : String; aInstance : TFormatSettings); TLocaleInitCallback = Procedure(aLocale : String; aInstance : TFormatSettings);
// class var InitLocaleHandler : TLocaleInitCallback; class var InitLocaleHandler : TLocaleInitCallback;
class function Create: TFormatSettings; overload; static; class function Create: TFormatSettings; overload; static;
class function Create(const ALocale: string): TFormatSettings; overload; static; class function Create(const ALocale: string): TFormatSettings; overload; static;
end; end;
@ -4901,7 +4901,7 @@ end;
class function TFormatSettings.Create: TFormatSettings; class function TFormatSettings.Create: TFormatSettings;
begin begin
Result := Create(GetBrowserLocale); Result := Create(GetJSLocale);
end; end;
@ -4928,14 +4928,13 @@ begin
Result.NegCurrFormat:=0; Result.NegCurrFormat:=0;
Result.CurrencyDecimals:=2; Result.CurrencyDecimals:=2;
Result.CurrencyString:='$'; Result.CurrencyString:='$';
If Assigned(TFormatSettings.InitLocaleHandler) then
// If Assigned(TFormatSettings.InitLocaleHandler) then TFormatSettings.InitLocaleHandler(UpperCase(aLocale),Result);
// TFormatSettings.InitLocaleHandler(UpperCase(aLocale),Result);
end; end;
class function TFormatSettings.GetBrowserLocale: string; assembler; class function TFormatSettings.GetJSLocale: string; assembler;
asm asm
return navigator.language; return Intl.DateTimeFormat().resolvedOptions().locale
end; end;
class function TFormatSettings.GetLocaleDecimalSeparator(const ALocale: string): string; assembler; class function TFormatSettings.GetLocaleDecimalSeparator(const ALocale: string): string; assembler;