2017-02-17 294 views
1

中檢測所選語言我想用IDP插件下載文件,但我需要選擇語言功能中的文件。例如:以英文和西班牙文安裝,文件爲myfile_x86_eng.exemyfile_x86_spa.exe。 我對Pascal一無所知,而且我搜索了互聯網和堆棧溢出而未找到結果。Inno Setup在[代碼]

我需要的是這樣的:

#include ". \ Idp.iss" 

[Languages] 
Name: "English"; MessagesFile: "compiler: Languages \ English.isl"; 
Name: "Spanish"; MessagesFile: "compiler: Languages \ Spanish.isl"; 

[Code] 
Procedure InitializeWizard(): string; 
Var 
    Language: string; 
Begin 
    Language: = ExpandConstant ('{param: LANG}'); 
    If Language = 'English' then 
    Begin 
    IdpAddFile ('https://myweb.com/myfile_x86_eng.exe', ExpandConstant ('{tmp} \ myfile_x86_eng.exe')); 
    End 
    Else 
    If Language = 'Spanish' then 
    Begin 
    IdpAddFile ('https://myweb.com/myfile_x86_esp.exe', ExpandConstant ('{tmp} \ myfile_x86_spa.exe')); 
    End; 
End; 

其他方式,可以作出這樣myfile_x86_ {lang} .exe或類似的東西

回答

0

使用語言變量ActiveLanguage function

if ActiveLanguage = 'English' then 
begin 
    IdpAddFile('https://www.example.com/myfile_x86_eng.exe', 
      ExpandConstant('{tmp}\myfile_x86_eng.exe')); 
end 
    else 
if ActiveLanguage = 'Spanish' then 
begin 
    IdpAddFile('https://www.example.com/myfile_x86_esp.exe', 
      ExpandConstant('{tmp}\myfile_x86_spa.exe')); 
end; 
+0

謝謝...我將嘗試它... 乾杯...... ;-) – alfreire