Prechádzať zdrojové kódy

* East Asian locales era patch from Mantis #33003

git-svn-id: trunk@37944 -
marco 7 rokov pred
rodič
commit
af85960d62
2 zmenil súbory, kde vykonal 9 pridanie a 26 odobranie
  1. 3 3
      rtl/objpas/sysutils/dati.inc
  2. 6 23
      rtl/win/sysutils.pp

+ 3 - 3
rtl/objpas/sysutils/dati.inc

@@ -1079,7 +1079,7 @@ var
         ':': StoreStr(@FormatSettings.TimeSeparator, 1);
 	'[': if (fdoInterval in Options) then isInterval := true else StoreStr(FormatCurrent, 1);
 	']': if (fdoInterval in Options) then isInterval := false else StoreStr(FormatCurrent, 1);
-        ' ', 'C', 'D', 'H', 'M', 'N', 'S', 'T', 'Y', 'Z', 'F' :
+        ' ', 'C', 'D', 'H', 'M', 'N', 'S', 'T', 'Y', 'Z', 'F' {$IFDEF MSWindows}, 'G', 'E'{$ENDIF MSWindows} :
         begin
           while (P < FormatEnd) and (UpCase(P^) = Token) do
             Inc(P);
@@ -1183,7 +1183,7 @@ var
             'E':
                begin
                  if not Eastasiainited then InitEastAsia;
-                 if Not(isEnable_E_Format) then StoreStr(@FormatCurrent^, 1)
+                 if Not(isEnable_E_Format) then StoreStr(FormatCurrent, 1)
                   else
                    begin
                      while (P < FormatEnd) and (UpCase(P^) = Token) do
@@ -1197,7 +1197,7 @@ var
              'G':
                begin
                  if not Eastasiainited then InitEastAsia;
-                 if Not(isEnable_G_Format) then StoreStr(@FormatCurrent^, 1)
+                 if Not(isEnable_G_Format) then StoreStr(FormatCurrent, 1)
                   else
                    begin
                      while (P < FormatEnd) and (UpCase(P^) = Token) do

+ 6 - 23
rtl/win/sysutils.pp

@@ -744,39 +744,22 @@ end;
 function ConvertEraString(Count ,Year,Month,Day : integer) : string;
   var
     ASystemTime: TSystemTime;
-    buf: array[0..100] of char;
+    wbuf: array[0..100] of WideChar;
     ALCID : LCID;
-    PriLangID : Word;
-    SubLangID : Word;
 begin
   Result := ''; if (Count<=0) then exit;
   DateTimeToSystemTime(EncodeDate(Year,Month,Day),ASystemTime);
 
   ALCID := GetThreadLocale;
 //  ALCID := SysLocale.DefaultLCID;
-  if GetDateFormatA(ALCID , DATE_USE_ALT_CALENDAR
-      , @ASystemTime, PChar('gg')
-      , @buf, SizeOf(buf)) > 0 then
+  if GetDateFormatW(ALCID , DATE_USE_ALT_CALENDAR
+      , @ASystemTime, PWChar('gg')
+      , @wbuf, SizeOf(wbuf)) > 0 then
   begin
-    Result := buf;
     if Count = 1 then
-    begin
-      PriLangID := ALCID and $3FF;
-      SubLangID := (ALCID and $FFFF) shr 10;
-      case PriLangID of
-        LANG_JAPANESE:
-          begin
-            Result := Copy(WideString(Result),1,1);
-          end;
-        LANG_CHINESE:
-          if (SubLangID = SUBLANG_CHINESE_TRADITIONAL) then
-          begin
-            Result := Copy(WideString(Result),1,1);
-          end;
-      end;
-    end;
+      wbuf[1] := #0;
+    Result := string(WideString(wbuf));
   end;
-// if Result = '' then Result := StringOfChar('G',Count);
 end;
 
 function ConvertEraYearString(Count ,Year,Month,Day : integer) : string;