leapold
Posts: 12
Joined: Thu May 31, 2018 4:15 pm

Selected language in the custom action

Thu Jul 15, 2021 2:02 pm

Hello,
I would like to get user selected language from the combo box in the custom action( c# code).
How can I?

Catalin
Posts: 6510
Joined: Wed Jun 13, 2018 7:49 am

Re: Selected language in the custom action

Thu Jul 15, 2021 2:14 pm

Hello,

In order to achieve that, you could proceed as it follows:

- retrieve, in your custom action, the ProductLanguage Property

How to set an installer property using custom actions

- based on its' value, display the message in the specified language

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

leapold
Posts: 12
Joined: Thu May 31, 2018 4:15 pm

Re: Selected language in the custom action

Thu Jul 15, 2021 2:22 pm

Hi.
I am running exe (console app C# project).How can I get session?

leapold
Posts: 12
Joined: Thu May 31, 2018 4:15 pm

Re: Selected language in the custom action

Thu Jul 15, 2021 2:32 pm

Should I set property inside installer? Is it possible to get demo example?

Catalin
Posts: 6510
Joined: Wed Jun 13, 2018 7:49 am

Re: Selected language in the custom action

Thu Jul 15, 2021 2:56 pm

Hello,
I am running exe (console app C# project).How can I get session?
This might be a little bit more complicated then.

I thought you were using a C# custom action (DLL)

This is still possible to achieve, though.

First of all:
Should I set property inside installer?
No, the ProductLanguage property is automatically set according to the setup's language. For more information, please see the article I have linked above.

Here is how you could proceed in your scenario:

- create a .TXT file containing the language of your setup through a "Text file update" operation, e.g.:
txtFileUpdate1.png
txtFileUpdate1.png (112.34KiB)Viewed 11321 times
txtFileUpdate2.png
txtFileUpdate2.png (30.67KiB)Viewed 11321 times

The above should create, after the installation, a file similar to this:
txtFileUpdateAfterInstallation.png
txtFileUpdateAfterInstallation.png (59.61KiB)Viewed 11321 times


- read, from that .TXT file, the code and based on it, display the message in the required language - this should be done from your custom action's code

This will work if your custom action is scheduled after the "Add resources" action group and with its' "Execution Time" set to "When the system is being modified (deferred)".

The reason behind this is the fact that the text file update operation executes on a component install, which executes during the "Add resources" action group.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

leapold
Posts: 12
Joined: Thu May 31, 2018 4:15 pm

Re: Selected language in the custom action

Thu Jul 15, 2021 3:22 pm

I hope I describe good what I want to reach. The language is going to be selected from installation package.
The custom action with c# code it is last step.
Attachments
2.JPG
2.JPG (28.02KiB)Viewed 11318 times
1.JPG
1.JPG (75.58KiB)Viewed 11318 times
Last edited by leapold on Thu Jul 15, 2021 4:02 pm, edited 1 time in total.

leapold
Posts: 12
Joined: Thu May 31, 2018 4:15 pm

Re: Selected language in the custom action

Thu Jul 15, 2021 4:02 pm

I can't add New Text File Update. This option is available only for Enterprise edition. Can I add text file instead?
Also where is Edit text file Update?

Catalin
Posts: 6510
Joined: Wed Jun 13, 2018 7:49 am

Re: Selected language in the custom action

Fri Jul 16, 2021 4:35 pm

Hello,
I can't add New Text File Update. This option is available only for Enterprise edition. Can I add text file instead?
The "Text file update" is indeed available starting with our Enterprise suite.

Unfortunately, the simple text file will not help here, because we need it updated with the language code.

Another solution would be using the "Registry" page to store the language code in the registry. You can then read the value from the registry entry in your custom action.
reg.png
reg.png (31.47KiB)Viewed 11276 times


Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

leapold
Posts: 12
Joined: Thu May 31, 2018 4:15 pm

Re: Selected language in the custom action

Mon Jul 19, 2021 3:10 pm

Hello,

I added new key [RV] but after installation I can't find registry and value.

Where should I see it in the registry editor?
Attachments
3.JPG
3.JPG (18.8KiB)Viewed 10833 times

Catalin
Posts: 6510
Joined: Wed Jun 13, 2018 7:49 am

Re: Selected language in the custom action

Mon Jul 19, 2021 3:47 pm

Hello,

If your installation type ("Install Parameters" page) is of "per-machine" type, there are two locations:

win+R --> type regedit.exe

- HKEY_LOCAL_MACHINE\SOFTWARE\Your_Manufacturer\Product_Name\[RV]

- HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Your_Manufacturer\Product_Name\[RV] --> if the package is 32-bit installed on a 64-bit machine

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”