问题
I want to have all CustomMessages
in language files (extension isl
). Also, some of the messages contain preprocessor constants, e.g.
ALREADY_INSTALLED={#MyAppName} is already installed on this computer.
The message should be displayed like this:
"My-really-nice-App is already installed on this computer"
But what I get is:
"{#MyAppName} is already installed on this computer."
The following works like a charm when I have the code, the message defined in a [CustomMessages]
-topic and #define MyAppName
in the same iss file:
MsgBox(ExpandConstant('{cm:ALREADY_INSTALLED}'), ...);
Any clues?
回答1:
Only .iss
file is preprocessed, not .isl
files.
But you can use FmtMessage function:
FmtMessage(CustomMessage('ALREADY_INSTALLED'), ['{#MyAppName}'])
With
ALREADY_INSTALLED=%1 is already installed on this computer.
Note that in Pascal Script code, you better use CustomMessage('FOO'), instead of ExpandConstant('{cm:FOO}')
.
Similar question: Pass parameters to custom messages defined in .isl files.
If you need to preprocess the standard messages, see Can I use .isl files for the messages with preprocessor directives in Inno Setup?
来源:https://stackoverflow.com/questions/52700413/how-can-i-use-language-files-with-custom-messages-with-preprocessor-constants