How can I rewrite predefined messages for the WelcomePage in different languages in Inno Setup?

旧街凉风 提交于 2021-01-21 11:22:25

问题


I have 3 languages and I need to change the AppName according to the language I've chosen. I wrote this:

[Setup]
AppName={code:GetMyAppName}

[Code] 
function GetMyAppName(param : String) : String;
begin
  case ActiveLanguage of
    'en': Result := 'AB Office Client';
    'ru': Result := 'Клиент АБ Офис';
    'ua': Result := 'Клієнт АБ Офіс';
  end;   
end;

And here I have my language-dependent [Messages] section:

[Messages]
en.WelcomeLabel1=Welcome to [APPNAME] Setup program. This program will install [APPNAME] on your computer.
ru.WelcomeLabel1=Вас приветствует программа установки [APPNAME] Эта программа установит [APPNAME] на Ваш компьютер.
ua.WelcomeLabel1=Вас вітає програма встановлення [APPNAME]. Ця програма встановить [APPNAME] на Ваш комп'ютер.

My question is: how can I transfer the result of the function GetMyAppName to the [APPNAME]? I could have done that by inserting a previously defined constant like {#AppName}, but I cannot use functions from the [Code] section with preprocessor's directives. The same question is when I use [CustomeMessages] instead. Like this:

[Setup]
AppName={cm:AppName}

[CustomMessages]
en.AppName=AB Office Client
ru.AppName=Клиент АБ Офис
ua.AppName=Клієнт АБ Офіс

Also, I know that there are some arguments %1 and %2 in [Messages] section, but i have no idea how to use them. For me %1 and %2 argument just won't transfer to the AppName and AppVersion accordingly. They just stay as %1 and %2. And finally, changing the .isl file manually is not an option for me. Would really appreciate your help. Have a nice day.


回答1:


The defaults are:

WelcomeLabel1=Welcome to the [name] Setup Wizard
WelcomeLabel2=This will install [name/ver] on your computer.%n%nIt is recommended that you close all other applications before continuing.

So just follow that – Use [name] and [name/ver] placeholders in your translations.


If you need other customization, see Can I use .isl files for the messages with preprocessor directives in Inno Setup? or Full preprocessor support in Inno Setup language files (isl).



来源:https://stackoverflow.com/questions/60673544/how-can-i-rewrite-predefined-messages-for-the-welcomepage-in-different-languages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!