Inno Setup 製作多國語言安裝介面與程式範例 |
|
ddy
站務副站長 發表:262 回覆:2105 積分:1169 註冊:2002-07-13 發送簡訊給我 |
這個範例,部份參考Inno Setup 的範例,與小弟一些些心得
可以整合相同主程式,不同語系的安裝程式為同一個安裝程式,由user 決定安裝什麼語系
若有不明白之處,歡迎討論
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>新網頁1</title>
</head> <body> [Setup]
;一般資訊 AppName=BNELiteV2 v3.6.14 AppVerName=BNELiteV2 v3.6.14 AppPublisher={code:GetString|Company} AppPublisherURL=http://www.excelsi.com.tw/ AppSupportURL=http://www.excelsi.com.tw/ AppUpdatesURL=http://www.excelsi.com.tw/ DefaultDirName={pf}\BNELiteV2 DefaultGroupName={code:GetString|Company} OutputDir=..\Output\Excelsi_NoAutoupdate SourceDir=.\Source Files Compression=zip/9 AdminPrivilegesRequired=true ChangesAssociations=false AppMutex=Win 95/98/ME WinNT/2000/XP ExtraDiskSpaceRequired=25 WindowVisible=true BackColor2=clGreen WizardImageBackColor=clGreen AppVersion=v 3.6.14 WizardStyle=modern UninstallStyle=modern DiskSpanning=false UninstallLogMode=overwrite ShowTasksTreeLines=true WizardImageFile=compiler:Gwizmodernimage.bmp WizardSmallImageFile=compiler:wizmodernsmallimage.bmp UninstallDisplayName=BNELiteV2 Uninstall UserInfoPage=true DetectLanguageUsingLocale=true UninstallDisplayIcon={app}\unins000.exe [Files] ;安裝時所需的檔案 Source: System\ASYCFILT.DLL; DestDir: {sys}; Flags: regserver noregerror sharedfile ignoreversion restartreplace overwritereadonly onlyifdoesntexist Source: System\CMDLGCHT.DLL; DestDir: {sys}; Flags: regserver noregerror sharedfile onlyifdoesntexist Source: System\COMCAT.DLL; DestDir: {sys}; Flags: regserver noregerror sharedfile onlyifdoesntexist Source: System\COMDLG32.OCX; DestDir: {sys}; Flags: regserver noregerror sharedfile ignoreversion [INI] ;安裝完成後寫入建立 ini file,可供後續程式讀取 ;例如寫出一個Language 選項,主程式便可依據此選項決定顯示成什麼語言 Filename: {app}\BNELite.ini; Section: Setup; Key: Language; String: {code:GetString|Language}; Flags: createkeyifdoesntexist uninsdeleteentry [Icons] Name: {group}\{code:GetString|Prog}\BNELiteV2; Filename: {app}\BNELiteV2.exe; WorkingDir: {app}; IconFilename: {app}\BNELiteV2.exe; Comment: 指形機連線程式; IconIndex: 0 Name: {group}\{code:GetString|Prog}\Export; Filename: {app}\Export.exe; WorkingDir: {app}; IconFilename: {app}\Export.exe; IconIndex: 0 Name: {group}\{code:GetString|URL}; Filename: {app}\BNELiteV2.url; IconIndex: 0; WorkingDir: {app}; Comment: 連至卓仕科技 Name: {userdesktop}\BNELiteV2; Filename: {app}\BNELiteV2.exe; IconIndex: 0 Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\BNELiteV2; Filename: {app}\BNELiteV2.exe; IconIndex: 0 Name: {group}\BNELiteV2 Uninstall; Filename: {app}\unins000.exe; WorkingDir: {app}; IconFilename: {app}\unins000.exe; IconIndex: 0 [Run] ;安裝後立即執行 Filename: {app}\BNELiteV2.exe; Description: {code:GetString|Run} BNELiteV2; Flags: nowait postinstall hidewizard [Languages] ;安裝時載入的語言界面與配合該語系的說明文件檔 Name: ChineseTrad; MessagesFile: ..\ChineseTrad4.isl; LicenseFile: ..\license.txt; InfoBeforeFile: ..\readme.txt; InfoAfterFile: ..\readme1.txt Name: ChineseSimp; MessagesFile: ..\ChineseSimp4.isl; LicenseFile: ..\licenseS.txt; InfoBeforeFile: ..\readmeS.txt; InfoAfterFile: ..\readmeS1.txt Name: English; MessagesFile: ..\Default4.isl [Code] var msgCopyright:string; procedure AboutButtonOnClick(Sender: TObject); begin MsgBox(msgCopyright, mbInformation, mb_Ok); end; procedure InitializeWizard(); var AboutButton, CancelButton: TButton; begin CancelButton := WizardForm.CancelButton; AboutButton := TButton.Create(WizardForm); AboutButton.Left := WizardForm.ClientWidth - CancelButton.Left - CancelButton.Width; AboutButton.Top := CancelButton.Top; AboutButton.Width := CancelButton.Width; AboutButton.Height := CancelButton.Height; AboutButton.Caption := '&About...'; AboutButton.OnClick := @AboutButtonOnClick; AboutButton.Parent := WizardForm; end; function InitializeSetup(): Boolean; begin //ActiveLanguage 取得目前語系 if ActiveLanguage='ChineseTrad' then begin msgCopyright:='卓仕科技版權所有 !!'; end; if ActiveLanguage='ChineseSimp' then begin msgCopyright:='袗帊褪撮唳垀衄 !!'; end; if ActiveLanguage='English' then begin msgCopyright:='Copyright (C) EXCEL SYSTEMS,INC.'; end; { Let Setup run } Result := True; end; function GetString(S: String): String; //此程式依當時語系與傳入代碼,取回對應的文字 begin if ActiveLanguage='ChineseTrad' then begin if S = 'Company' then Result := '卓仕科技'; if S = 'Prog' then Result := '連線程式'; if S = 'URL' then Result := '卓仕科技網站'; if S = 'Run' then Result := '執行'; if S = 'Language' then Result :='ChineseT'; if S = 'Corp' then Result :='1200000042E2C29EABC4910216C8818C49B145BB61EC876280818657AAB8DE4FB2614C26'; if S = 'ProgName' then Result :='0F0000008A57A7C29C2DAFEDA4A58500607B136D'; end; if ActiveLanguage='ChineseSimp' then begin if S = 'Company' then Result := '袗帊褪撮'; if S = 'Prog' then Result := '蟀盄最宒'; if S = 'URL' then Result := '袗帊褪撮厙桴'; if S = 'Run' then Result := '硒俴'; if S = 'Language' then Result :='ChineseS'; if S = 'Corp' then Result :='1200000042E2C29EABC4910216C8818C49B145BB61EC876280818657AAB8DE4FB2614C26'; if S = 'ProgName' then Result :='0F0000008A57A7C29C2DAFEDA4A58500607B136D'; end; if ActiveLanguage='English' then begin if S = 'Company' then Result := 'EXCELSI'; if S = 'Prog' then Result := 'Connect program'; if S = 'URL' then Result := 'EXCELSI Homepage'; if S = 'Run' then Result := 'Run'; if S = 'Language' then Result :='English'; if S = 'Corp' then Result :='1200000042E2C29EABC4910216C8818C49B145BB61EC876280818657AAB8DE4FB2614C26'; if S = 'ProgName' then Result :='0F0000008A57A7C29C2DAFEDA4A58500607B136D'; end; end; </body> </html> |
itsayr.np
一般會員 發表:2 回覆:6 積分:1 註冊:2006-11-06 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |