如何在Inno Setup中用不同的语言重写WelcomePage的预定义消息? [英] How can I rewrite predefined messages for the WelcomePage in different languages in Inno Setup?
问题描述
我有3种语言,我需要根据选择的语言更改AppName
.
我是这样写的:
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;
这是我与语言相关的[Messages]
部分:
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] на Ваш комп'ютер.
我的问题是:如何将函数GetMyAppName
的结果传输到[APPNAME]
?我可以通过插入先前定义的常量(例如{#AppName}
)来完成此操作,但是我不能将[Code]
部分中的函数与预处理器的指令一起使用.
相同的问题是当我使用[CustomeMessages]
时.像这样:
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=Клієнт АБ Офіс
此外,我知道[Messages]
部分中有一些参数%1
和%2
,但是我不知道如何使用它们.对我来说,%1
和%2
自变量不会相应地转移到AppName
和AppVersion
.它们只是保持为%1
和%2
.
最后,对我来说,手动更改.isl
文件不是一种选择.
非常感谢您的帮助.祝你有美好的一天.
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.
推荐答案
默认值为:
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.
因此请遵循–在翻译中使用[name]
和[name/ver]
占位符.
So just follow that – Use [name]
and [name/ver]
placeholders in your translations.
如果您需要其他自定义,请参见我可以在Inno Setup中使用带预处理程序指令的消息使用.isl文件吗?或 Inno Setup语言文件(isl)中的完全预处理程序支持.
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).
这篇关于如何在Inno Setup中用不同的语言重写WelcomePage的预定义消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!