根据 Inno Setup 中的语言更改 AppName 和 AppDir

发布于 2024-11-16 06:32:20 字数 572 浏览 2 评论 0原文

自从我阅读有关 InnoSetup 的一些问题/答案以来已经有一段时间了,但它们似乎都没有帮助我......我想根据所选的语言更改 AppName 值,可用英语和西班牙语。因此,如果提示对话框时选择的语言是西班牙语,则 AppName 值应为“La Bola”;否则,如果选择英语,则 AppName 值应为“The Ball”。

同样的事情也适用于 AppDir。到目前为止我发现的唯一的就是这个 Inno setup 和 DefaultDirName,但我无法制作它与语言一起使用。还尝试按照以下示例使用 ISPP 条件:

#ifdef AppEnterprise
  #define AppName "My Program Enterprise Edition"
#else
  #define AppName "My Program"
#endif

但我无法使其与该语言一起使用,因为我不知道如何操作。

可以改变吗? =/

你好!

It's been a while since I was reading some questions/answers concerning InnoSetup, but none of them seems to help me... I want to change the AppName value depending on the language selected, being available English and Spanish. So, if the language chosen when prompted the dialog were Spanish, the AppName value should be "La Bola"; otherwise, if chosen English, the AppName value should be "The Ball".

The same thing applied to the AppDir. The only thing I've found so far was this Inno setup and DefaultDirName, but I cannot make it work with the Languages. Also tried using ISPP conditionals following an example:

#ifdef AppEnterprise
  #define AppName "My Program Enterprise Edition"
#else
  #define AppName "My Program"
#endif

but yet I cannot make it work with the Language, since I don't know how.

Is it possible to change it? =/

Greetings!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

空城仅有旧梦在 2024-11-23 06:32:20

我有同样的问题,所以我发布一个答案,以便其他人更快地得到它。

实际上,Inno Setup 安装文件夹中的 Examples\Languages.iss 文件中有一个示例。

简而言之:

[Setup]
AppName={cm:MyAppName}

然后

[Languages]
Name: en; MessagesFile: "compiler:Default.isl"
Name: es; MessagesFile: "compiler:Languages\Spanish.isl"

然后

[CustomMessages]
en.MyAppName=The Ball
es.MyAppName=La Bola

就是这样。有关更多详细信息,请参阅示例。顺便说一下,请注意有一个 LicenseFile 语言属性可用(示例中未提及):

[Languages]
Name: en; MessagesFile: "compiler:Default.isl"; LicenseFile: "eula_en.rtf"
Name: es; MessagesFile: "compiler:Languages\Spanish.isl"; LicenseFile: "eula_es.rtf"

I had the same question, so I'm posting an answer that would allow others to get it faster.

Actually, there is an example in Examples\Languages.iss file in Inno Setup installation folder.

To be short:

[Setup]
AppName={cm:MyAppName}

then

[Languages]
Name: en; MessagesFile: "compiler:Default.isl"
Name: es; MessagesFile: "compiler:Languages\Spanish.isl"

then

[CustomMessages]
en.MyAppName=The Ball
es.MyAppName=La Bola

That's it. For more details, see the example. By the way, note that there is a LicenseFile language attribute available (this is not mentioned in the example):

[Languages]
Name: en; MessagesFile: "compiler:Default.isl"; LicenseFile: "eula_en.rtf"
Name: es; MessagesFile: "compiler:Languages\Spanish.isl"; LicenseFile: "eula_es.rtf"
守不住的情 2024-11-23 06:32:20

查看可以翻译成不同语言的 CustomMessages,然后可以通过 {cm: 在 AppNameDefaultDirName 中使用它们。 .} 常量。

Look at CustomMessages which can be translated into different languages, These can then be used in AppName and DefaultDirName with the {cm:..} constant.

匿名。 2024-11-23 06:32:20

ISPP 是一个预处理器,因此这意味着此代码在编译 SETUP.EXE 之前运行。AppName

可用于多种用途,但其中一个是 SETUP.EXE 资源。这就是为什么它不能在运行时使用 {code: } 设置,

因此您可以在编译时为每种语言提供不同的 SETUP.EXE。

您可以通过多种方式执行此操作,例如使用 ISPP,这里是其中一种。

#define lang = "english"
[Setup]
#if lang == "english"
AppName=The Ball
#elif lang == "spanish"
AppName=La Bola
#else
# error Unsupported Language
#endif

AppVersion=1.5
;AppVerName=My Program 1.5
DefaultDirName={pf}\My Program

[Languages]
#if lang == "english"
Name: "en"; MessagesFile: "compiler:Default.isl"
#elif lang == "spanish"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
#else
# error Unsupported Language
#endif


[Files]
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion

ISPP is a Pre-Processor, so this means this code run's prior to compiling the SETUP.EXE

The AppName is used for a variety of purposes but one is the SETUP.EXE Resource. Which is why it can't be set at runtime using {code: }

So you could a compile time and have a different SETUP.EXE for each language.

You can do this in a number of ways, using the ISPP, here is one.

#define lang = "english"
[Setup]
#if lang == "english"
AppName=The Ball
#elif lang == "spanish"
AppName=La Bola
#else
# error Unsupported Language
#endif

AppVersion=1.5
;AppVerName=My Program 1.5
DefaultDirName={pf}\My Program

[Languages]
#if lang == "english"
Name: "en"; MessagesFile: "compiler:Default.isl"
#elif lang == "spanish"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
#else
# error Unsupported Language
#endif


[Files]
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文