-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Use dotnet-resgen to compile resx files #743
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
Conversation
Needs to be `processName`, not `program`. Go figure.
Specifically this enables us to leverage `dotnet-resgen` to auto-generate the `resx` files into `resources` files for the default culture, which are then compiled into the SMA assembly. This requires a change to the C# bindings. The Windows build system takes `file.resx` and compiles `file.resources`, but CLI prepends the assembly name, thus compiling `SMA.file.resources`. So the resource manager in the generated bindings must be adjusted to look for `SMA.file` instead of `file`. Note that C# bindings cannot yet be auto-generated. Given localized resources of the form `file.en-US.resx`, `dotnet-resgen` will create a satellite assembly and publish it to `en-US/SMA.resources.dll`, so #666 will not be a technical problem.
This is a runtime dependency that causes an internal exception to be thrown and caught when not available.
So that the resource manager doesn't try to load a non-existent satellite assembly (and thus throw). The culture `en-US` is the default `CurrentCulture` on all platforms I tested, specifically not `en`. Note that there is a problem with the FullCLR build where some other assembly is still attempting to reference `Logging.resources` instead of `System.Management.Automation.Logging.resources`.
|
@vors I'm going to need some help making this work with the FullCLR build. There is a problem with the FullCLR build where some other assembly is still attempting to reference |
|
ok, lets take a look on Tuesday |
|
Here it is: This error would make sense if SMA's resource C# bindings had not been fixed. However, as evidenced from Core and Linux working, SMA indeed is fine. So what, outside of our code, would be using SMA's resource bindings directly? |
|
Found it. The This now requires PowerShell/psl-monad#42 too. |
Improvement
Specifically this enables us to leverage
dotnet-resgento auto-generate theresxfiles intoresourcesfiles for the default culture, which are then compiled into the respective assemblies.@vors Since
.resourcesno longer need to be compiled on Windows and added towindows-build, #732 should be updated to map the.resxfiles into the superproject as well.Requires PowerShell/psl-windows-build#10.
Caveat
This requires a change to the C# bindings. The Windows build system takes
file.resxand compilesfile.resources, but CLI prepends the assembly name, thus compilingSMA.file.resources. So the resource manager in the generated bindings must be adjusted to look forSMA.fileinstead offile.Note that C# bindings cannot yet be auto-generated; so if they need to be updated, the above must be changed again. This is still blocked on #395 / dotnet/cli#819. However, the C# bindings need to be updated only if strings are added/removed, not when their content changes.
Localization
@vors I've discovered that given localized resources of the form
file.en-US.resx,dotnet-resgenwill create a satellite assembly and publish it toen-US/SMA.resources.dll, so #666 will not be a technical problem./cc @SteveL-MSFT @BrucePay @dantraMSFT
This change is