如何翻译Inno Setup中MsgBox中包含的文本?

时间:2014-05-07 13:26:41

标签: installation translation inno-setup pascalscript

我的inno安装脚本中包含一个[code]部分,在安装过程中为用户显示了一些信息。我希望能够使用用户在安装期间选择的语言翻译这些语言。他们的文本目前是英文的,例如想用俄语等翻译。我知道我必须在Language.isl文件中做一些事情。以下是此类文字的示例。

if MsgBox('Previous program found. It is recommendeded to uninstall it and install a fresh program. Please note that your data will not be deleted during the uninstallation. Do you want to continue?', mbConfirmation, MB_YESNO) = IDYES then
      begin etc

1 个答案:

答案 0 :(得分:5)

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"

[CustomMessages]
CustomMessage=Undefined //just in case (should be equal to English)
english.CustomMessage=English Selected
german.CustomMessage=German Selected
polish.CustomMessage=Polish Selected

[Code]
function InitializeSetup: Boolean;
begin
  Result := True;  
  MsgBox(ExpandConstant('{cm:CustomMessage}'), mbInformation, MB_OK);
end;