mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Let TExtForm translate all strings on a form, to reduce the code in any FormCreate event
This commit is contained in:
6
packages/Delphi10.3/heidisql.dpr
vendored
6
packages/Delphi10.3/heidisql.dpr
vendored
@ -45,6 +45,7 @@ uses
|
||||
change_password in '..\..\source\change_password.pas' {frmPasswordChange},
|
||||
Vcl.Themes,
|
||||
Vcl.Styles,
|
||||
Vcl.Graphics,
|
||||
theme_preview in '..\..\source\theme_preview.pas' {frmThemePreview};
|
||||
|
||||
{.$R *.RES}
|
||||
@ -71,10 +72,15 @@ begin
|
||||
AppSettings.Free;
|
||||
Application.Terminate;
|
||||
end else begin
|
||||
|
||||
AppLanguage := AppSettings.ReadString(asAppLanguage);
|
||||
// SysLanguage may be zh_CN, while we don't offer such a language, but anyway, this is just the current system language:
|
||||
SysLanguage := DefaultInstance.GetCurrentLocaleName;
|
||||
UseLanguage(AppLanguage);
|
||||
// First time translation via dxgettext.
|
||||
// Issue #3064: Ignore TFont, so "Default" on mainform for WinXP users does not get broken.
|
||||
TP_GlobalIgnoreClass(TFont);
|
||||
|
||||
Application.Initialize;
|
||||
Application.Title := APPNAME;
|
||||
Application.UpdateFormatSettings := False;
|
||||
|
@ -124,7 +124,6 @@ end;
|
||||
|
||||
procedure TAboutBox.FormCreate(Sender: TObject);
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
lblAppName.Font.Size := Round(lblAppName.Font.Size * 1.5);
|
||||
lblAppName.Font.Style := [fsBold];
|
||||
lblAppWebpage.Font.Color := clBlue;
|
||||
|
@ -89,7 +89,6 @@ end;
|
||||
|
||||
procedure TfrmBinEditor.FormCreate(Sender: TObject);
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
HasSizeGrip := True;
|
||||
end;
|
||||
|
||||
|
@ -57,7 +57,6 @@ uses main, apphelpers;
|
||||
|
||||
procedure TfrmPasswordChange.FormCreate(Sender: TObject);
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
HasSizeGrip := True;
|
||||
end;
|
||||
|
||||
|
@ -45,7 +45,6 @@ uses main;
|
||||
|
||||
procedure TColumnSelectionForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
HasSizeGrip := True;
|
||||
Width := AppSettings.ReadInt(asColumnSelectorWidth);
|
||||
Height := AppSettings.ReadInt(asColumnSelectorHeight);
|
||||
|
@ -239,7 +239,6 @@ var
|
||||
LibPath, LibFile: String;
|
||||
begin
|
||||
// Fix GUI stuff
|
||||
TranslateComponent(Self);
|
||||
HasSizeGrip := True;
|
||||
FixDropDownButtons(Self);
|
||||
lblDownloadPlink.Font.Style := [fsUnderline];
|
||||
|
@ -67,7 +67,6 @@ const
|
||||
|
||||
procedure TCopyTableForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
HasSizeGrip := True;
|
||||
FixDropDownButtons(Self);
|
||||
Width := AppSettings.ReadInt(asCopyTableWindowWidth);
|
||||
|
@ -41,7 +41,6 @@ uses main, apphelpers;
|
||||
|
||||
procedure TCreateDatabaseForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
lblCreateCode.Caption := lblCreateCode.Caption + ':';
|
||||
// Setup SynMemoPreview
|
||||
SynMemoCreateCode.Highlighter := Mainform.SynSQLSynUsed;
|
||||
|
@ -47,8 +47,6 @@ procedure TDataSortingForm.FormCreate(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
|
||||
ColumnNames := TStringList.Create;
|
||||
// Take column names from listColumns and add here
|
||||
for i:=0 to Mainform.SelectedTableColumns.Count-1 do begin
|
||||
|
@ -55,7 +55,6 @@ uses main, apphelpers;
|
||||
|
||||
procedure TfrmEditVariable.FormCreate(Sender: TObject);
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
HasSizeGrip := True;
|
||||
Width := AppSettings.ReadInt(asEditVarWindowWidth);
|
||||
Height := AppSettings.ReadInt(asEditVarWindowHeight);
|
||||
|
@ -103,7 +103,6 @@ procedure TfrmExportGrid.FormCreate(Sender: TObject);
|
||||
var
|
||||
FormatDesc: String;
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
HasSizeGrip := True;
|
||||
Width := AppSettings.ReadInt(asGridExportWindowWidth);
|
||||
Height := AppSettings.ReadInt(asGridExportWindowHeight);
|
||||
|
@ -4,7 +4,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Windows, Messages, System.Types, StdCtrls, Clipbrd,
|
||||
SizeGrip, apphelpers, Vcl.Graphics, Vcl.Dialogs;
|
||||
SizeGrip, apphelpers, Vcl.Graphics, Vcl.Dialogs, gnugettext;
|
||||
|
||||
type
|
||||
// Form with a sizegrip in the lower right corner, without the need for a statusbar
|
||||
@ -36,6 +36,7 @@ begin
|
||||
inherited;
|
||||
InheritFont(Font);
|
||||
HasSizeGrip := False;
|
||||
TranslateComponent(Self);
|
||||
end;
|
||||
|
||||
|
||||
|
@ -116,7 +116,6 @@ const
|
||||
|
||||
procedure TfrmInsertFiles.FormCreate(Sender: TObject);
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
HasSizeGrip := True;
|
||||
ListFiles.Images := GetSystemImageList;
|
||||
DragAcceptFiles(Handle, True);
|
||||
|
@ -93,7 +93,6 @@ const
|
||||
|
||||
procedure Tloaddataform.FormCreate(Sender: TObject);
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
HasSizeGrip := True;
|
||||
// Restore settings
|
||||
Width := AppSettings.ReadInt(asCSVImportWindowWidth);
|
||||
|
@ -36,7 +36,6 @@ uses apphelpers, main;
|
||||
|
||||
procedure TfrmLogin.FormCreate(Sender: TObject);
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
Caption := APPNAME + ' - Login';
|
||||
MainForm.VirtualImageListMain.GetBitmap(144, imgIcon.Picture.Bitmap);
|
||||
lblPrompt.Font.Size := 10;
|
||||
|
@ -1677,12 +1677,6 @@ var
|
||||
begin
|
||||
caption := APPNAME;
|
||||
|
||||
// First time translation via dxgettext.
|
||||
// Issue #3064: Ignore TFont, so "Default" on mainform for WinXP users does not get broken.
|
||||
// Issue #557: Apply images *after* translating main menu, so top items don't get unused
|
||||
// space left besides them.
|
||||
TP_GlobalIgnoreClass(TFont);
|
||||
TranslateComponent(Self);
|
||||
FixDropDownButtons(Self);
|
||||
|
||||
// Load preferred ImageCollection into VirtualImageList
|
||||
|
@ -483,7 +483,6 @@ var
|
||||
GridColorsPreset: TGridColorsPreset;
|
||||
IconPack: String;
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
HasSizeGrip := True;
|
||||
|
||||
Width := AppSettings.ReadInt(asPreferencesWindowWidth);
|
||||
|
@ -23,7 +23,6 @@ type
|
||||
procedure btnConfigureClick(Sender: TObject);
|
||||
procedure btnPrintClick(Sender: TObject);
|
||||
procedure comboPrintersChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
@ -39,11 +38,6 @@ uses main, apphelpers, table_editor, dbconnection;
|
||||
{$R *.DFM}
|
||||
|
||||
|
||||
procedure TprintlistForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
end;
|
||||
|
||||
procedure TprintlistForm.FormShow(Sender: TObject);
|
||||
begin
|
||||
// show!
|
||||
|
@ -59,7 +59,6 @@ uses apphelpers, main;
|
||||
|
||||
procedure TfrmSearchReplace.FormCreate(Sender: TObject);
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
HasSizeGrip := True;
|
||||
comboSearch.Items.Text := AppSettings.ReadString(asFindDialogSearchHistory);
|
||||
comboReplace.Items.Text := AppSettings.ReadString(asFindDialogReplaceHistory);
|
||||
|
@ -62,7 +62,6 @@ end;
|
||||
|
||||
procedure TfrmSelectDBObject.FormCreate(Sender: TObject);
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
HasSizeGrip := True;
|
||||
Width := AppSettings.ReadInt(asSelectDBOWindowWidth);
|
||||
Height := AppSettings.ReadInt(asSelectDBOWindowHeight);
|
||||
|
@ -93,7 +93,6 @@ begin
|
||||
memoDescription.Height := AppSettings.ReadInt(asSQLHelpPnlRightTopHeight);
|
||||
Caption := DEFAULT_WINDOW_CAPTION;
|
||||
FixVT(treeTopics);
|
||||
TranslateComponent(Self);
|
||||
HasSizeGrip := True;
|
||||
|
||||
treeTopics.Clear;
|
||||
|
@ -107,7 +107,6 @@ var
|
||||
SessionPaths: TStringList;
|
||||
begin
|
||||
Caption := MainForm.actSynchronizeDatabase.Caption;
|
||||
TranslateComponent(Self);
|
||||
HasSizeGrip := True;
|
||||
FixVT(treeSource);
|
||||
FixVT(treeDifferences);
|
||||
|
@ -225,7 +225,6 @@ var
|
||||
dt: TListNodeType;
|
||||
Obj: TDBObject;
|
||||
begin
|
||||
TranslateComponent(Self);
|
||||
HasSizeGrip := True;
|
||||
FixDropDownButtons(Self);
|
||||
OUTPUT_FILE := _('Single .sql file');
|
||||
|
@ -202,7 +202,6 @@ begin
|
||||
actSearchFindNext.Hint := MainForm.actQueryFindAgain.Hint;
|
||||
actSearchReplace.Caption := MainForm.actQueryReplace.Caption;
|
||||
actSearchReplace.Hint := MainForm.actQueryReplace.Hint;
|
||||
TranslateComponent(Self);
|
||||
FixDropDownButtons(Self);
|
||||
// Assign linebreak values to their menu item tags, to write less code later
|
||||
menuWindowsLB.Tag := Integer(lbsWindows);
|
||||
|
@ -51,7 +51,6 @@ uses main;
|
||||
procedure TfrmUpdateCheck.FormCreate(Sender: TObject);
|
||||
begin
|
||||
// Should be false by default. Callers can set this to True after Create()
|
||||
TranslateComponent(Self);
|
||||
imgDonate.OnClick := MainForm.DonateClick;
|
||||
imgDonate.Visible := MainForm.HasDonated(False) = nbFalse;
|
||||
end;
|
||||
|
@ -215,7 +215,6 @@ begin
|
||||
FixVT(listUsers);
|
||||
FixVT(treePrivs);
|
||||
Mainform.RestoreListSetup(listUsers);
|
||||
TranslateComponent(Self);
|
||||
PrivsRead := Explode(',', 'SELECT,SHOW VIEW,SHOW DATABASES,PROCESS,EXECUTE');
|
||||
PrivsWrite := Explode(',', 'ALTER,CREATE,DROP,DELETE,UPDATE,INSERT,ALTER ROUTINE,CREATE ROUTINE,CREATE TEMPORARY TABLES,CREATE VIEW,INDEX,TRIGGER,EVENT,REFERENCES,CREATE TABLESPACE');
|
||||
PrivsAdmin := Explode(',', 'RELOAD,SHUTDOWN,REPLICATION CLIENT,REPLICATION SLAVE,SUPER,LOCK TABLES,GRANT,FILE,CREATE USER');
|
||||
|
Reference in New Issue
Block a user