volks73 / cargo-wix

A cargo subcommand to build Windows installers for rust projects using the WiX Toolset
https://volks73.github.io/cargo-wix
Apache License 2.0
306 stars 25 forks source link

culture set in Cargo.toml is not used #148

Closed cstkingkey closed 2 years ago

cstkingkey commented 2 years ago

[package.metadata.wix]

compiler-args = ["-nologo", "-wn"]

culture = "ja-JP"

volks73 commented 2 years ago

Thank you for submitting this issue. I would like to resolve this and ensure the culture is being set appropriately from the Cargo.toml file, but I am going to need more information and details about the environment, any error or log messages, and a description of the current behavior.

For example, can you please run the cargo wix -vvv command to increase the log level and share the content from STDOUT when running the command? There should be two DEBUG statements for the culture: (i) self.culture = ..., which will indicate if a CLI option was used, and (ii) further down a culture = ..., which indicate the culture that is used when creating the installer after taking into account the existence of the CLI option and metadata from the Cargo.toml. In other words, the second culture = ... DEBUG statement should be ja-JP. Can you confirm?

I did a relatively quick review and there are numerous unit tests related to reading the package metadata from the Cargo.toml file, and some of these unit tests do cover the culture field. All unit tests currently pass within my environment and machine. Could you possibly run the tests? See the Tests section of the README for more information on running the tests, but it is essentially just cargo test. Note, the integration tests will currently fail if you are using Rust v1.53 or newer (#146), but the unit tests should work. For example, the latest CI test completed successfully.

It is possible a unit test is missing for this specific environment and operating conditions. So, more information about your environment would be greatly appreciated.

How do you know the culture is not set from the Cargo.toml file? What is not happening that should be happening? Generally, the culture field and corresponding CLI option are supposed to work in concert with the locale field and corresponding CLI option. Do you have an appropriate localization file for the culture you using?

cstkingkey commented 2 years ago

DEBUG: self.culture = Some("en-US") second one is DEBUG: culture = EnUs In between, it outputs ""wix": Object({"culture": String("ja-JP"), "dbg-build": Bool(false), "dbg-name": Bool(false)})"

cstkingkey commented 2 years ago

when using cli option, the generated msi do have been localized. And it's not when using cargo.toml setting.

cstkingkey commented 2 years ago

culture has a default value en-us, so this line always evaluated to be true, culture set in toml never have the the chance. https://github.com/volks73/cargo-wix/blob/065013105319303ce65a4a2b9471741b235b8e0b/src/create.rs#L728