使用Inno的多语言安装程序 [英] Multiple language installer using Inno

查看:137
本文介绍了使用Inno的多语言安装程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Inno Setup构建的应用程序安装程序.
我想使用安装程序支持多种语言,以允许用户选择语言.

我的应用程序对任何一种语言都使用很多通用文件,但是对于某些文件(例如字符串资源,帮助文件等),每种语言都会有这些文件.

我希望安装程序包含所有这些文件.然后,当用户选择一种语言时,它将安装所需的任何内容,然后以某种方式仅安装特定于语言的文件.这些文件的目标位置将始终相同,但是要复制的源文件将有所不同(即,取决于语言).我不知道该怎么做.

我发现我可以将ShowLanguageDialog设置为在安装中显示一个页面,让您选择语言.我知道您可以在[语言]部分中设置安装程序的语言.所以这是完成的一步.

现在,我所需要做的就是以某种方式根据所选语言安装文件.因此,例如对于帮助文件,安装程序将包含我的应用翻译成的所有语言的文件.这些文件将位于以lang id命名的源文件夹中(例如,波兰语为\ pl_PL \ help).但是安装程序应将其安装到程序文件夹目录中的帮助目录.

我可以执行此操作的另一种方法是,根据选择的语言将其安装在不同的目标目录中(在Inno中,我可以使用{language}).
因此,例如,如果选择波兰语,则帮助文件将安装在(MyAppsInstallDir)\ help \ pl_PL \ files.html"中.
但是问题在于,我需要在我的应用中编写其他代码来查找那些文件,这只会增加不必要的复杂性.

Hi, i have an installer for my application which is built using Inno Setup.
I want to support multiple languages using the installer to allow the user to choose the language.

My app uses a lot of common files for any language, but for some files - such as the string resources, help files, etc - there will be these files for each language.

I want the installer to contain all these files. Then when the user has selected a language, it will install whatever it needs and then somehow only install the language specific files. The destination for these files will always be the same, but the source files that get copied will be different (i.e. depending on the language). I do not know how to do this.

I found out that i can set ShowLanguageDialog to show a page in installation that lets you choose the language. And i know you can set the installer''s language in the [Language] section. So that''s one step done.

Now all i need to do is somehow conditionally install files based on the selected language. So for, say, help files, the installer will contain the files for all languages that my app is translated in. These will be in source folders named after the lang id (e.g. Polish is \pl_PL\help). But the installer should just install it to a help directory in the program folders directory.

One other way i could do this is to install in different destination directories based on what language is selected (in Inno, i can use {language}).
So, for example, if Polish is selected, the help files will be installed in "(MyAppsInstallDir)\help\pl_PL\the files.html".
But the problem with this is that i need to write additional code in my app to find those files, which just adds unnecessary complexity.

推荐答案

您首先要创建/使用适当的ISL文件修改[语言]部分:

[语言]
名称:en; MessagesFile:"compiler:Default.isl"
名称:nl; MessagesFile:"compiler:Languages \ Dutch.isl"


然后,您要做的就是在[文件]部分的项目中添加一个语言"参数:

[文件]
资料来源:"Help.chm"; DestDir:"{app}";语言:en
来源:"Dutch \ Help.chm"; DestDir:"{app}";语言:nl

-只有在用户选择安装语言的情况下,才会安装带有语言"标签的项目.

-每次没有"Languages"标签的项目都将被安装.
You do it by first creating/amending the [Languages] section, using the appropriate ISL files:

[Languages]
Name: en; MessagesFile: "compiler:Default.isl"
Name: nl; MessagesFile: "compiler:Languages\Dutch.isl"


Then all you have to do is add a "Languages" parameter to the items in the [Files] section:

[Files]
Source: "Help.chm"; DestDir: "{app}"; Languages: en
Source: "Dutch\Help.chm"; DestDir: "{app}"; Languages: nl

-- An item with a "Languages" tag will only be installed if the user has chosen that language for the installation.

-- Any item in that does not have a "Languages" tag will be installed every time.


这篇关于使用Inno的多语言安装程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆