* improve language id handling, patch by cdslow, mantis #36135

git-svn-id: trunk@43117 -
This commit is contained in:
marco 2019-10-04 11:19:13 +00:00
parent beb606be13
commit b5c8d2a097

View File

@ -117,6 +117,8 @@ Type
procedure Execute; procedure Execute;
procedure AddStreamToArchive(AFileName, APath: String; AStream: TStream; Compress: Boolean = True); procedure AddStreamToArchive(AFileName, APath: String; AStream: TStream; Compress: Boolean = True);
procedure PostAddStreamToArchive(AFileName, APath: String; AStream: TStream; Compress: Boolean = True); procedure PostAddStreamToArchive(AFileName, APath: String; AStream: TStream; Compress: Boolean = True);
procedure LocaleToLanguageID(Locale: LongWord);
function LocaleFromLanguageID: LongWord;
property WindowSize: LongWord read FWindowSize write FWindowSize default 2; // in $8000 blocks property WindowSize: LongWord read FWindowSize write FWindowSize default 2; // in $8000 blocks
property FrameSize: LongWord read FFrameSize write FFrameSize default 1; // in $8000 blocks property FrameSize: LongWord read FFrameSize write FFrameSize default 1; // in $8000 blocks
property FilesToCompress: TStrings read FFileNames; property FilesToCompress: TStrings read FFileNames;
@ -127,7 +129,7 @@ Type
property ReadmeMessage : String read fReadmeMessage write fReadmeMessage; property ReadmeMessage : String read fReadmeMessage write fReadmeMessage;
property Cores : integer read fcores write fcores; property Cores : integer read fcores write fcores;
{ MS Locale ID code } { MS Locale ID code }
property LocaleID: dword read ITSFHeader.LanguageID write ITSFHeader.LanguageID; property LocaleID: LongWord read LocaleFromLanguageID write LocaleToLanguageID;
end; end;
{ TChmWriter } { TChmWriter }
@ -274,6 +276,16 @@ begin
end; end;
end; end;
procedure TITSFWriter.LocaleToLanguageID(Locale: LongWord);
begin
ITSFHeader.LanguageID := NToLE(Locale);
end;
function TITSFWriter.LocaleFromLanguageID: LongWord;
begin
Result := LEToN(ITSFHeader.LanguageID);
end;
procedure TITSFWriter.InitHeaderSectionTable; procedure TITSFWriter.InitHeaderSectionTable;
begin begin
// header section 0 // header section 0
@ -315,7 +327,7 @@ begin
Unknown2 := NToLE(Longint(-1)); Unknown2 := NToLE(Longint(-1));
//DirectoryChunkCount: LongWord; //DirectoryChunkCount: LongWord;
LanguageID := NToLE(DWord($0409)); LanguageID := ITSFHeader.LanguageID;
GUID := ITSPHeaderGUID; GUID := ITSPHeaderGUID;
LengthAgain := NToLE(DWord($54)); LengthAgain := NToLE(DWord($54));
Unknown3 := NToLE(Longint(-1)); Unknown3 := NToLE(Longint(-1));
@ -798,6 +810,7 @@ begin
FPostStream := TMemoryStream.Create;; FPostStream := TMemoryStream.Create;;
FDestroyStream := FreeStreamOnDestroy; FDestroyStream := FreeStreamOnDestroy;
FFileNames := TStringList.Create; FFileNames := TStringList.Create;
InitITSFHeader;
end; end;
destructor TITSFWriter.Destroy; destructor TITSFWriter.Destroy;
@ -815,7 +828,6 @@ end;
procedure TITSFWriter.Execute; procedure TITSFWriter.Execute;
begin begin
InitITSFHeader;
FOutStream.Position := 0; FOutStream.Position := 0;
FSection1Size := 0; FSection1Size := 0;
@ -987,7 +999,7 @@ begin
FSection0.WriteWord(NToLE(Word(4))); FSection0.WriteWord(NToLE(Word(4)));
FSection0.WriteWord(NToLE(Word(36))); // size FSection0.WriteWord(NToLE(Word(36))); // size
FSection0.WriteDWord(NToLE(DWord($0409))); FSection0.WriteDWord(ITSFHeader.LanguageID);
FSection0.WriteDWord(0); FSection0.WriteDWord(0);
FSection0.WriteDWord(NToLE(DWord(Ord(FFullTextSearch and FFullTextSearchAvailable)))); FSection0.WriteDWord(NToLE(DWord(Ord(FFullTextSearch and FFullTextSearchAvailable))));