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

how to create localized property with empty value

G'day,

I'm using AI 7.7 build 28804

I'd like to include an abbreviated language name within the bootstrapper file name. I created a new private property "LangName" and localized the value. My bootstrapper file name is now configured like this:

Code: Select all

[|ProductName] Setup [|ProductVersion][|LangName]
If the language is English, I would like the LangName property to be an empty string so that nothing is added to the bootstrapper file name. If the language is German, the LangName property should be "de". I tried the following approaches:

===== A: make value empty in the dictionary =====

My dictionary entry for the localized LangName property looks like this:

Code: Select all

<ENTRY id="Property.LangName">
    <STRING lang="en" value=""/>
    <STRING lang="de" value="de"/>
</ENTRY>
This works fine for the German bootstrapper, which gets the "de" string. However, when the English bootstrapper is created, the value of LangName is the default value as defined in the .aip file, not the empty string from the dictionary.


===== B: make value empty in the aip project =====

I then tried to edit the default value of the property and make it empty. I opened the Edit Property dlg and cleared the "Value" field, but the "OK" button disables and you cannot save your changes.

I also tried editing the aip file directly (I know this is dangerous - it was just for testing purposes) and gave the LangName property an empty value:

Code: Select all

<ROW Property="LangName" Value="" ValueLocId="Property.LangName"/>
However, this approach also fails because then when I load the aip project I get a fatal error and the project does not open:
AI error - empty property value.JPG
AI error - empty property value.JPG (7.43 KiB) Viewed 12318 times
Is there a way to create a localized property with an empty value? Or perhaps there is another way to achieve what I want?

Thanks for any help you can offer,
Todd
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: how to create localized property with empty value

Hi Todd,
However, when the English bootstrapper is created, the value of LangName is the default value as defined in the .aip file, not the empty string from the dictionary.
This is because the project language is not localized. Project values have priority over the ones in the custom dictionary.
I then tried to edit the default value of the property and make it empty. I opened the Edit Property dlg and cleared the "Value" field, but the "OK" button disables and you cannot save your changes.
Please try setting the property to:

Code: Select all

{}
This is the Windows Installer standard value for setting empty properties.

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 property with empty value

Thanks for your reply, Cosmin.

Just so that you know I've done my homework and don't think I'm being lazy, I've read all of the formal "localization" and "translation" docs:
- http://www.advancedinstaller.com/user-g ... uages.html
- http://www.advancedinstaller.com/user-g ... uages.html
- http://www.advancedinstaller.com/user-g ... tring.html
- http://www.advancedinstaller.com/user-g ... aries.html
- http://www.advancedinstaller.com/user-g ... ialog.html

I've also read many forum posts to try and resolve the issue myself, but to no avail.
This is because the project language is not localized.
I don't understand what this means. The default language for the project is English, and I've added one additional language (German) on the Translations page.
Project values have priority over the ones in the custom dictionary.
According to the "Localization Dialog" documentation, if I select the "Always translate this string" option (for the value of my LangName property), that level of "fine granularity" should allow me localize this particular element, regardless of the global "coarse granularity" setting. I did, in fact, select this option and then added a corresponding entry in my custom dictionary.
AI - property L10n - always translate.JPG
AI - property L10n - always translate.JPG (20.14 KiB) Viewed 12309 times
Also, it's probably worth mentioning that in my custom dictionary I do *not* use the ignore="en" attribute, so the English translation for my LangName property should not be ignored because of that.

I tried making the English value "en" as a test. My custom dictionary now looks like this:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DICTIONARY type="multilanguage">
  <ENTRY id="Property.LangName">
    <STRING lang="en" value="en"/>
    <STRING lang="de" value="de"/>
  </ENTRY>
</DICTIONARY>
Regardless, when the single-language package is built for English, the value of my LangName property is the default value from the project and not the customized "en" value from my dictionary. Sorry if I am missing something really obvious, but I just don't understand. Do I need to somehow localize the default project language (English) in order to override the default value of my LangName property? If "yes", how do I localize the default project language? I would really like to understand how this all works, so if you could please explain it in greater detail I would truly appreciate it.
Please try setting the property to:

Code: Select all

{}
I tried your suggestion but when I then build the English package, the value of the LangName property resolves to the literal string "{}" and not an empty string. So that approach does not seem to work.


Thanks for your help with this,
Todd
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: how to create localized property with empty value

Hi Todd,
I don't understand what this means. The default language for the project is English, and I've added one additional language (German) on the Translations page.
Basically, since the project language is English, the English strings in your dictionary are ignored.
According to the "Localization Dialog" documentation, if I select the "Always translate this string" option (for the value of my LangName property), that level of "fine granularity" should allow me localize this particular element, regardless of the global "coarse granularity" setting.
This option always makes Advanced Installer always translate the string for other languages. For the project language the string is the default value.
Regardless, when the single-language package is built for English, the value of my LangName property is the default value from the project and not the customized "en" value from my dictionary.
This is by design. Since the project language is English, the default property value represents the English string. The dictionary is used to specify values for other languages.
Do I need to somehow localize the default project language (English) in order to override the default value of my LangName property?
No. In your project you can set the English value and in your dictionary you can configure values for other languages (German). English strings are included in the dictionary so it's easier to translate the other strings while editing.
I tried your suggestion but when I then build the English package, the value of the LangName property resolves to the literal string "{}" and not an empty string.
Yes, I forgot this works only when setting the property during install. Try this approach:
- set the English value as the default property value in your project
- localize the value only for German in your custom dictionary

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 property with empty value

Thanks for the detailed explanation, much appreciated.

However, the original problem remains - how to allow the default property value to be empty.
Yes, I forgot this works only when setting the property during install. Try this approach:
- set the English value as the default property value in your project
- localize the value only for German in your custom dictionary
As stated in my original post, I would like the English value to be an empty string but I am not able to use an empty string as the default property value because AI doesn't allow it (please see my original post with screen-shots).

Is there some other syntax for using an empty string as the property value?

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

Re: how to create localized property with empty value

Hi,

Unfortunately Windows Installer doesn't support this. However, you can try this approach:
- create the property in "Install Parameters" page with a default value (it doesn't matter what)
- in "Custom Actions" page create a Property set with formatted custom action under "InstallUISequence" -> "Begin"
- configure it to set your property to this value:

Code: Select all

{}
- share this action with "InstallExecuteSequence" -> "Begin" by dragging it while Shift key is pressed

This way the property is added into your MSI so it can be localized and the custom action sets it to an empty value.

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 property with empty value

Thanks for the clever solution, Cosmin.

Unfortunately, that approach will set the property to an empty string during the install, not during the build. As I said in my original post, I am using this property to name the bootstrapper EXE, so I need the property value to be resolved (to an empty string) at the time of the build.

Seems like it's just not possible to do what I want. I suppose I can deal with it downstream from AI.

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

Re: how to create localized property with empty value

Hi Todd,

Currently this is not supported by Advanced Installer. However, we will consider adding this improvement in a future version. Thank you for your suggestion.

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 property with empty value

Understood.

As a point of reference, a few other users have also asked about creating empty properties:
- "I cannot create an empty property"
- "Creating Empty Properties"
(the actual problem was public -vs- private, but the empty property issue was still raised)

Thanks for your time,
Todd
mtilev
Posts: 44
Joined: Wed Dec 04, 2013 1:19 pm

Re: how to create localized property with empty value

This seems to be a rather old topic, but I would also like to vote for the feature to set an empty installer property that is evaluated at build time and can be used for naming the bootstrapper or MSI files.

Greetings,

Milen Tilev
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: how to create localized property with empty value

Hello Milen,

We've counted your vote for this improvement too. However, since our TODO list has plenty of tasks at the moment, I'm afraid implementing this has a low priority for now. Thank you for your understanding.

We'll update this thread as soon as this improvement will be available.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”