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

msgbox localization - aicustact.dll uses OS locale

Ahoy,

I'm using AI 7.7 build 28804

===== Project Config =====
- configured with multiple languages (currently English and German)
- configured to build one installer per language

===== Problem =====
I'm struggling with a msgbox localization issue. During the uninstall, I prompt the user with a Yes/No msgbox which asks whether user data and settings generated by my app should be deleted. I would like the msgbox buttons to be localized according to the installer language, *not* according to the OS locale. For example, if my installer language is German but running on an OS with English locale, the msgbox buttons should be in German - Ja/Nein.

===== Uninstall Cleanup =====
Originally, my project relied on the Uninstall Cleanup functionality to create the msgbox. After inspecting my .aip project, it seems this functionality is contained in ResourceCleaner.dll

The Yes/No msgbox created by the Uninstall Cleanup behaves correctly - the button text is localized according to the installer's language, regardless of the OS locale.

===== Predefined Custom Action =====
For several reasons, I switched to a predefined custom action to create the msgbox, and abandoned the "Uninstall Cleanup" approach. As part of the uninstall sequence, I added a predefined custom action:
  • source path = <AI_CUSTACTS>aicustact.dll
  • source type = dll
  • function name = MsgBox
  • action data = (my message to the user)
The custom action works fine, except that the msgbox buttons are now localized according to the OS locale instead of the installer's language.

===== Summary =====
It seems that msgbox localization is different between ResourceCleaner.dll and aicustact.dll; ResourceCleaner.dll uses the installer's language (which is correct, in my opinion) while aicustact.dll uses the OS locale.

Is there a specific reason for this difference? I would like the "MsgBox" predefined custom action to use the installer's language to localize the Yes/No button labels; is this possible?

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

Re: msgbox localization - aicustact.dll uses OS locale

Hi Todd,

Unfortunately the Message Box strings cannot be localized using the function from the aicustact.dll library. You can try to implement the function yourself from within a custom action and localize the content of the message box.
Here is a MSDN link to get you started : http://msdn.microsoft.com/en-us/library ... 85%29.aspx .

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

Re: msgbox localization - aicustact.dll uses OS locale

Thanks for your reply, Mihai.

I am still wondering why the Message Box function in aicustact.dll behaves differently than the equivalent function in ResourceCleaner.dll
Both libraries create a message box, but only one library localizes the message box according to the language of the installer. I understand that they are different dll-s, but from a product-wide perspective this difference in localization strikes me as inconsistent and confusing. Both libs should localize in the same manner.

I would really like to avoid writing my own dll just to get the button-text localized correctly. However, if it must, I'm a bit unclear how to force the button-text to localize according to a language that I specify. The Message Box API does not provide a way to do this. Do I need to call the SetThreadLocale function?

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

Re: msgbox localization - aicustact.dll uses OS locale

Hello Todd,

After investigating this issue with our development team in more detail, it seems that you cannot localize the buttons text from the message box.
Thank you for bringing it to our attention, we will consider a way to make this work in a future version.

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

Re: msgbox localization - aicustact.dll uses OS locale

Thanks for the follow-up, Mihai.

I would like to re-emphasize that it really seems as though AI is *already capable* of displaying/creating a message-box whose button-text is localized according to the installer's language. Two examples are:
(1) the "Uninstall Cleanup" msgbox prompt as provided by ResourceCleaner.dll (mentioned this in my original post)
(2) clicking the Cancel button on any standard dialog during the install sequence

The second example is very quick and easy to recreate:
* translate the AI project in multiple languages, let's say English and German
* configure the project to create separate packages per language, build the packages
* run the German installer on an English edition of Windows (assume the "Regional Options" are configured for English as well)
* on the WelcomeDlg, observe that all text and buttons are correctly localized in German
* click the Cancel button ("Abbrechen" in German)
* this results in a message-box which asks the user to confirm the cancel, and the Yes/No buttons in the message-box *are* correctly localized in German:
DE installer on EN locale.JPG
DE installer on EN locale.JPG (79.98 KiB) Viewed 18146 times
I'm assuming this Yes/No message-box is created by AI and not by Windows Installer. Is that assumption correct? If the message-box were created by Windows Installer, the OS locale would be used to localize the button-text, which would have resulted in "Yes" / "No" strings.

If my assumption is correct, then AI already has the capability to generate a message-box (or customized window which acts just like a message-box) with button-text which is localized to the installer's lang. So why can't that existing capability just be included in the aicustact.dll functions?

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

Re: msgbox localization - aicustact.dll uses OS locale

Hello,

I am afraid the message box you are referring to is displayed by Windows Installer. We will be adding improvements to the Message Box custom action to support buttons localization.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”