Browse Source

* Removed navigator reference

michael 4 years ago
parent
commit
e998fe474a
1 changed files with 9 additions and 10 deletions
  1. 9 10
      packages/rtl/sysutils.pas

+ 9 - 10
packages/rtl/sysutils.pas

@@ -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
-//         TLocaleInitCallback = Procedure(aLocale : String; aInstance : TFormatSettings);
-//      class var InitLocaleHandler : TLocaleInitCallback;
+      Type
+         TLocaleInitCallback = Procedure(aLocale : String; aInstance : TFormatSettings);
+      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
-//    TFormatSettings.InitLocaleHandler(UpperCase(aLocale),Result);
+  If Assigned(TFormatSettings.InitLocaleHandler) then
+    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;