toddpatt
Posts: 111
Joined: Fri Jan 08, 2010 1:36 am

how to create localized source path

G'day,

I'm using AI 7.7 build 28804
My project is configured to create one package per language (option set on the "Languages" tab).

I need to include a localized jar in each single-language package. The file name of the jar must be the same ("resources.jar") in each package, but the contents will be different. When I build the localized jars with my Ant scripts, they are created in separate folders:
.../de/resources.jar
.../en/resources.jar

(side note: when I install the jar on the target machine, I do not want to include the language sub-folder)

I am struggling with how to build the single-language packages, such that each package gets the correct jar. What I think I need is to create a variable for the source-path folder, and then localize that variable. Something like:
.../[|Lang]/resources.jar
.../[|Lang]/resources.jar

I found this "Source Path variable" forum post which discusses how to use a variable in a source path. I followed the instructions and it seems to work fine, but it appears that I cannot localize Path Variables since they are global and not per-project.

Is there another approach I could use?

Thanks much,
Todd
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: how to create localized source path

Hi Todd,

You can try this approach:
- go to "Files and Folders" page
- for the folder which should contain the JAR create a different subfolder for each language
- set Install folder content into the parent folder option for each subfolder
- add the appropriate JAR files in each subfolder
- in "Organization" page you can condition the component of each JAR with the "ProductLanguage" property (the "Edit Condition" dialog has a predefined condition which may help you)

Please note that in "Files and Folders" page you can right-click a file and use "Go To Component" menu to select the file component. With this approach only one JAR is installed based on the installation language.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
toddpatt
Posts: 111
Joined: Fri Jan 08, 2010 1:36 am

Re: how to create localized source path

Thanks for your suggestion, Cosmin.

I followed your steps, but the result is that each package now contains both the English version of resources.jar and the German version of resources.jar. If my localized jars were small, this approach would work fine and I would be happy to use it.

However, my localized jars are moderately large (contain images with translated text, etc), so including all of them inside each single-language package is not an acceptable solution. As I add to the number of supported languages, each single-language package will grow larger and larger. I understand that when the package is installed, only the appropriate jar will be installed. However, the problem is that the packages are just too large and result in long download times for the user, as well as long extraction times when the bootstrapper unpacks itself ("extracting the main application files"). It also makes the automated builds slower, since all of the localized jars are added to each package.

Ideally, I would like the English package to contain only the English version of resources.jar and the German package to contain only the German version of resources.jar.

Is there another way that this could be achieved?

Thanks,
Todd
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: how to create localized source path

Hi Todd,

This can be done only by using multiple builds:
- in Media page create a separate build for each language
- in "Translations" page set only one language for each build
- in Organization page create a separate feature for each language
- include each language feature only in one build (the one specific to the feature language)
- move the JARs into the appropriate features

For example, you can have an English build which contains the English feature that has your English JAR. This build uses only English in "Translations" page.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
toddpatt
Posts: 111
Joined: Fri Jan 08, 2010 1:36 am

Re: how to create localized source path

Thanks for the solution, Cosmin.

I considered that approach, but was hoping to avoid it because the number of builds will significantly increase as I need to support more and more languages. Before I needed to support other languages I already had two builds, so now for each new language I would need to add two additional builds. This would work, but I think it could quickly turn into a maintenance headache.

My request seems very similar to the "Source Path variable" request, but with the added ability to localize the source path variable. It sounds like that enhancement has been given a high priority - do you know if the new source path variables can be localized? If so, that would solve my problem and keep the number of builds low.

Thanks for your help,
Todd
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: how to create localized source path

Hello Todd,

Indeed that issue has been resolved and will be available in the update that will follow the upcoming version of AI.
The path variable is not localizable I am afraid.
There might be a workaround, however it's not the most elegant solution:
Instead of having one build with multiple languages, have multiple builds, one for each language. Source paths can be set to environment variables, so you could trigger each build separately from the command line, and set the environment variable to an appropriate value before each build.

The shortcoming is you have an invariance here that needs to be maintained: that is, the environment variable's value needs to match the build's language. Should one change, the other needs to be updated accordingly.

Let me know if this would achieve the desired effect.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
toddpatt
Posts: 111
Joined: Fri Jan 08, 2010 1:36 am

Re: how to create localized source path

Thanks for your reply, Gabriel.

The idea of having a build per language is similar to what Cosmin proposed (see above). I didn't like this idea because I already have two builds for just the English version. However, if I can create a source path variable and then set its value to an environment variable (as you suggested), I think that would be an acceptable compromise.

The September 15th post by user "bccc" claims that if a path variable is set to an environment variable, building from the cmd-line does not work. So I assume that I can only use this approach once the update to the next AI release is out? Is that correct?

Thanks for your help,
Todd
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: how to create localized source path

Hello Todd,
So I assume that I can only use this approach once the update to the next AI release is out? Is that correct?
That is correct. You will be able to use path variables from the command line starting with version 8.1.

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
hammerh
Posts: 2
Joined: Sat Dec 18, 2010 5:28 pm

Re: how to create localized source path

cosmin wrote:Hi Todd,

You can try this approach:
- go to "Files and Folders" page
- for the folder which should contain the JAR create a different subfolder for each language
- set Install folder content into the parent folder option for each subfolder
- add the appropriate JAR files in each subfolder
- in "Organization" page you can condition the component of each JAR with the "ProductLanguage" property (the "Edit Condition" dialog has a predefined condition which may help you)

Please note that in "Files and Folders" page you can right-click a file and use "Go To Component" menu to select the file component. With this approach only one JAR is installed based on the installation language.

Regards,
Cosmin
Can you please explain better the last point? I select UserLanguageID= but I don't know what to put equals to. Can you help?

Thanks
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: how to create localized source path

Hello,
- in "Organization" page you can condition the component of each JAR with the "ProductLanguage" property (the "Edit Condition" dialog has a predefined condition which may help you)
This part in my colleague's description refers to the "ProductLanguage"(Set to the language identifier of the installation language.) property. When conditioning your components using this property they will be installed only if the installation language corresponds with the one you specify in your condition.For example the following condition will install the component only the installation language is german:

Code: Select all

(ProductLanguage = 2055)
I select UserLanguageID= but I don't know what to put equals to. Can you help?
Do you need to localize your components using the "UserLanguageID"(Set to the default language identifier of the current user) property?
For example, to condition the component using the UserLanguageID you can have this syntax in the condition field of the component:

Code: Select all

(UserLanguageID = 2055)
All the language codes are specified when selecting the last sample condition from the "Predefined Conditions" list in the "Edit Condition" window. This is mentioned by my colleague in the quote at the beginning of this post as well.

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”