Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Localized progress action messages. #704

Closed
GilesBathgate opened this issue Aug 12, 2019 · 9 comments
Closed

Question: Localized progress action messages. #704

GilesBathgate opened this issue Aug 12, 2019 · 9 comments

Comments

@GilesBathgate
Copy link
Contributor

In the legacy wix based installer we used the following in our .wxl file:

  <String Id="ProgressTextInstallValidate" Overridable="yes">Validating install</String>
  <String Id="ProgressTextInstallFiles" Overridable="yes">Copying new files</String>
  <String Id="ProgressTextInstallFilesTemplate" Overridable="yes">File: [1],  Directory: [9],  Size: [6]</String>
...

Despite adding this to the wixsharp project, the action messages don't seem to be translated. project.LocalizationFile = "en-us.wxl";

Is it still possible to use this mechanisim?

@GilesBathgate
Copy link
Contributor Author

GilesBathgate commented Aug 12, 2019

We just had to update ProgressDialog.ProcessMessage to do:

//messageRecord[0] - is reserved for FormatString value
var message = messageRecord[2].ToString();

if (message.IsNotEmpty())
    CurrentAction.Text = message;

@GilesBathgate
Copy link
Contributor Author

Resolved using the above.

@GilesBathgate
Copy link
Contributor Author

It would appear that:

  • messageRecord[0] - is reserved for FormatString value
  • messageRecord[1] - contains the untranslated id
  • messageRecord[2] - contains the message as translated in the wxl file.

@oleg-shilo
Copy link
Owner

Wow, very unusual convention.

Interesting how it handles the case when there are two formatting args:

messageRecord[0] - is reserved for FormatString value
messageRecord[1] - raw text arg1
messageRecord[2] - translated text arg1
messageRecord[3] - raw text arg2
messageRecord[4] - translated text arg2

or

messageRecord[0] - is reserved for FormatString value
messageRecord[1] - raw text arg1
messageRecord[2] - raw text arg2
messageRecord[3] - translated text arg1
messageRecord[4] - translated text arg2

@oleg-shilo
Copy link
Owner

It's really strange but it seems like messageRecird[2] unconditionally contains the string to display

messageRecord[0]    "Action 23:14:50: [1]. [2]" 
messageRecord[1]    "InstallFiles"  
messageRecord[2]    "Copying new files" 
messageRecord[3]    "File: [1],  Directory: [9],  Size: [6]"    
or 
messageRecord[0]    "Action 23:15:21: [1]. [2]" 
messageRecord[1]    "RegisterUser"  
messageRecord[2]    "Registering user"  
messageRecord[3]    "[1]"   

Meaning that your work around is exactly the fix that is needed.

Reopening this issue...

@oleg-shilo oleg-shilo reopened this Aug 15, 2019
@oleg-shilo
Copy link
Owner

Can you elaborate?

@GilesBathgate
Copy link
Contributor Author

GilesBathgate commented Aug 16, 2019

Is it the case that the values in the format strings are the indexes of the records to replace them with e.g:

messageRecord[0]    "Action 23:15:21: [1]. [2]" 
messageRecord[1]    "RegisterUser"  
messageRecord[2]    "Registering user"  
messageRecord[3]    "[1]" 

becomes:

messageRecord[0]  =>  "Action 23:15:21: RegisterUser. Registering user" 
messageRecord[3]   =>  "RegisterUser"

@oleg-shilo
Copy link
Owner

I also thought about that:

message = messageRecord.FormatString;
if (message.IsNotEmpty())
{
for (int i = 1; i < messageRecord.FieldCount; i++)
{
message = message.Replace("[" + i + "]", messageRecord[i].ToString());
}
}

But it was a bit weird to display formatted rec[0] in on the dialog. So I opted to rec[2].

@GilesBathgate
Copy link
Contributor Author

Yes I was thinking rather for the description message in the new MessageDialog feature #692

oleg-shilo pushed a commit that referenced this issue Aug 17, 2019
- Migrated to .NET4 as target runtime
- ManagedUI progress message localization improvements triggered by #704
oleg-shilo pushed a commit that referenced this issue Aug 17, 2019
Release v1.11.1
* Issue #704: Question: Localized progress action messages.
* Issue #696: ComponentCondition on CloseApplication doesn't appear to be working
* Removed `ValidateAssemblyCompatibility`as no longer needed since .NET4.0 is arguably a better choice for the recommended runtime
* Issue #604: Is it possible to suppress the "UAC prompt" text if UAC is not enabled?
* Issue #701: FR: Access to 32/64bit registry keys in Custom Actions (using .NET3.5)
* WixSharpVSIX (VS Templates): Release v1.8.3
  - Migrated to .NET4.0 as target runtime
  - ManagedUI progress message localization improvements triggered by #704
* Added a `Property.Secure`:
  ```C#
  new Property("Gritting", "Hello World!"){ Secure = true })
  ```
* More granular conditions for feature install/uninstall:
  ```C#
  var condition = feature.ShallInstall() && feature.IsInstalled();
  ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants