[CustomMessages] section用来定义自定义的一些{cm:}常量.
一个定义和使用的例子。
[CustomMessages]
CreateDesktopIcon=Create a &desktop icon
[Tasks]
Name: desktopicon; Description: "{cm:CreateDesktopIcon}"
CustomMessages是支持带参数的,从1%到9% 。支持重排列参数(例如,2%移动到了1%前面),也支持重复的参数(例如,1% …1% 2% )。在有参数的message中, 用两个连续的“%”来嵌入一个“%”,“%n”会创建一个line break。
In cases where there are multiple [Languages] section entries, specifying a [CustomMessages] section entry in your script (as opposed to an .isl file) will by default override that message for all languages. To apply a [CustomMessages] section entry to only one language, prefix it with the language’s internal name followed by a period. For example:
nl.CreateDesktopIcon=Maak een snelkoppeling op het &bureaublad
Currently, the .isl files for all languages that come with Inno Setup have the following custom messages defined and translated for each language (shown here with their English values):
NameAndVersion=%1 version %2
AdditionalIcons=Additional icons:
CreateDesktopIcon=Create a &desktop icon
CreateQuickLaunchIcon=Create a &Quick Launch icon
ProgramOnTheWeb=%1 on the Web
UninstallProgram=Uninstall %1
LaunchProgram=Launch %1
AssocFileExtension=&Associate %1 with the %2 file extension
AssocingFileExtension=Associating %1 with the %2 file extension...
AutoStartProgramGroupDescription=Startup:
AutoStartProgram=Automatically start %1
AddonHostProgramNotFound=%1 could not be located in the folder you selected.%n%nDo you want to continue anyway?
You may use these predefined custom messages in your own script. An example which uses UninstallProgram:
[Icons]
Name: "{group}\{cm:UninstallProgram,My Program}"; Filename: "{uninstallexe}"
{cm:MessageName}
{cm:MessageName,Arguments}
Embeds a custom message value based on the active language.
Example:
{cm:LaunchProgram,Inno Setup}
[Run]
;运行的程序信息
Filename: "{app}\{#AppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(AppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
; ViewHelpManual在语言文件中定义
Filename: "{app}\{#AppUserGuide}"; Description: "{cm:ViewHelpManual}"; Flags: postinstall shellexec skipifsilent unchecked
[1] https://jrsoftware.org/ishelp/index.php?topic=custommessagessection
[2] https://jrsoftware.org/ishelp/index.php?topic=consts