[CustomMessages] section

[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}"

1 {cm:MessageName}

{cm:MessageName}
{cm:MessageName,Arguments}
Embeds a custom message value based on the active language.

  • MessageName specifies the name of custom message to read from. See the [CustomMessages] section documentation for more information.
  • Arguments optionally specifies a comma separated list of arguments to the message value.
  • If you wish to include a comma, vertical bar (“|”), or closing brace (“}”) inside the constant, you must escape it via “%-encoding.” Replace the character with a “%” character, followed by its two-digit hex code. A comma is “%2c”, a vertical bar is “%7c”, and a closing brace is “%7d”. If you want to include an actual “%” character, use “%25”.
  • Each argument in Arguments may include constants. Note that you do not need to escape the closing brace of a constant as described above; that is only necessary when the closing brace is used elsewhere.
Example:
{cm:LaunchProgram,Inno Setup}

2 使用案例

[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

  • 18
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值