Skip to content

Commit 8807e3e

Browse files
committed
Re-creating the context menu when changing the language by @x-dragan-milosevic1993
1 parent b82c690 commit 8807e3e

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

Source/CleanupRegistry.reg

134 Bytes
Binary file not shown.

Source/Unit1.pas

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ TMain = class(TForm)
7474
function HandleParams: string;
7575
procedure SyncAppInfo;
7676
procedure DragAndDrop;
77-
procedure FileExtension(Recreate: boolean);
78-
procedure FileAssociation(Recreate: boolean);
77+
procedure FileExtension(const Recreate: boolean);
78+
procedure FileAssociation(const Recreate: boolean);
7979
{ Private declarations }
8080
public
8181
CompactContextMenu: boolean;
8282
procedure ImportRules(const FilePath: string);
8383
procedure ExportRules(const FilePath: string);
84-
procedure ContextMenu(Recreate, CompactMode: boolean);
84+
procedure ContextMenu(const Recreate, CompactMode: boolean);
8585
{ Public declarations }
8686
end;
8787

@@ -90,6 +90,7 @@ TMain = class(TForm)
9090
RuleNames, RulePaths: TStringList;
9191
CloseApplication: boolean;
9292
BlockedCount, UnblockedCount: integer;
93+
SystemLang: string;
9394

9495
// Tranlate / Ïåðåâîä
9596
ID_SEARCH: string;
@@ -455,7 +456,7 @@ procedure TMain.DragAndDrop;
455456
Reg.Free;
456457
end;
457458

458-
procedure TMain.ContextMenu(Recreate, CompactMode: boolean);
459+
procedure TMain.ContextMenu(const Recreate, CompactMode: boolean);
459460
const
460461
RegKey = '\exefile\shell\' + AppID;
461462
var
@@ -501,8 +502,9 @@ procedure TMain.FormCreate(Sender: TObject);
501502
LangFileName, Event: string;
502503
begin
503504
// Translate / Ïåðåâîä
504-
LangFileName:=GetLocaleInformation(LOCALE_SENGLANGUAGE) + '.ini';
505-
if not FileExists(ExtractFilePath(ParamStr(0)) + 'Languages\' + GetLocaleInformation(LOCALE_SENGLANGUAGE) + '.ini') then
505+
SystemLang:=GetLocaleInformation(LOCALE_SENGLANGUAGE);
506+
LangFileName:=SystemLang + '.ini';
507+
if not FileExists(ExtractFilePath(ParamStr(0)) + 'Languages\' + LangFileName) then
506508
LangFileName:='English.Ini';
507509
Ini:=TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Languages\' + LangFileName);
508510

@@ -801,7 +803,7 @@ procedure TMain.ImportRules(const FilePath: string);
801803
end;
802804
end;
803805

804-
procedure TMain.FileAssociation(Recreate: boolean);
806+
procedure TMain.FileAssociation(const Recreate: boolean);
805807
const
806808
RegKey = '\' + AppID + '.rules';
807809
var
@@ -822,7 +824,7 @@ procedure TMain.FileAssociation(Recreate: boolean);
822824
Reg.Free;
823825
end;
824826

825-
procedure TMain.FileExtension(Recreate: boolean);
827+
procedure TMain.FileExtension(const Recreate: boolean);
826828
const
827829
RegKey = '\.fer';
828830
var
@@ -847,10 +849,11 @@ procedure TMain.SyncAppInfo;
847849
Reg:=TRegistry.Create;
848850
Reg.RootKey:=HKEY_LOCAL_MACHINE;
849851
if Reg.OpenKey('\Software\r57zone\' + AppID, true) then begin
850-
IsDifferent:=(Reg.ReadString('Path') <> ParamStr(0)) or (Reg.ReadString('Version') <> AppVersion);
852+
IsDifferent:=(Reg.ReadString('Path') <> ParamStr(0)) or (Reg.ReadString('Version') <> AppVersion) or (Reg.ReadString('Language') <> SystemLang);
851853
if IsDifferent then begin
852854
Reg.WriteString('Path', ParamStr(0));
853855
Reg.WriteString('Version', AppVersion);
856+
Reg.WriteString('Language', SystemLang);
854857
end;
855858
Reg.CloseKey;
856859
end;

Source/clear.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ del *.cesettings
1010
del *.bak
1111
:del *.exe*
1212

13-
exit /b
13+
exit /b 0

0 commit comments

Comments
 (0)