-
Notifications
You must be signed in to change notification settings - Fork 9
/
TranslateComponentsUnit.pas
58 lines (50 loc) · 1.43 KB
/
TranslateComponentsUnit.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
unit TranslateComponentsUnit;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Menus, Buttons,
Vcl.ActnList, Vcl.Grids, Vcl.StdCtrls, Vcl.ComCtrls, Vcl.ToolWin,
Vcl.ActnMan, Vcl.ActnCtrls,
StringGridsUnit, ConstUnit, Vcl.ExtCtrls, Vcl.WinXCtrls, Vcl.ActnPopup, TreeViewExUnit;
procedure TranslateComponents(Form: TForm);
implementation
procedure TranslateComponents(Form: TForm);
var
i: Integer;
C: TComponent;
Strings: TStringList;
begin
for i := 0 to Form.ComponentCount-1 do
begin
C := Form.Components[i];
if (C is TAction) then
begin
if TAction(C).HelpKeyword.Length>0 then
TAction(C).Caption := TAction(C).HelpKeyword
else
TAction(C).Visible := False;
end
else
if (C is TBitBtn) then
begin
if TBitBtn(C).HelpKeyword.Length>0 then
TBitBtn(C).Caption := TBitBtn(C).HelpKeyword;
end
else
if (C is TLabel) then
begin
if TLabel(C).HelpKeyword.Length>0 then
begin
TLabel(C).Caption := TLabel(C).HelpKeyword;
TLabel(C).ShowHint := False;
end;
end
else
if (C is TMenuItem) then
begin
if TMenuItem(C).Hint.Length>0 then
if not Assigned(TMenuItem(C).Action) then TMenuItem(C).Caption := TMenuItem(C).Hint;
end;
end;
end;
end.