Catches failed NuGet.Commands resource events to localize NuGet.Commands with ILMerged nuget.exe resources #4802
Conversation
a65d97d to
8a0651f
Compare
|
This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 7 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch. |
8a0651f to
dce3d99
Compare
|
Team Review: Add functional tests (and some sort of environment variable tweaking) to modify OS language and test new added strings. |
|
This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 7 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch. |
| <!-- nuget.exe localized assemblies --> | ||
| <EmbeddedResource Include="$(OutputPath)\**\$(AssemblyName).resources.dll" Exclude="@(MergeExclude)" /> | ||
| <!-- NuGet.Commands localized assemblies --> | ||
| <LocResource Include="$(OutputPath)\**\NuGet.Commands.resources.dll" Exclude="@(MergeExclude)" /> |
There was a problem hiding this comment.
I'm just curious: what is the difference between this one and string resourceName = $"NuGet.CommandLine.{culture.Name}.{name}.dll"; in line 269? Which one contains exactly which resources?
There was a problem hiding this comment.
Below is a comparison table.
| Name | Description | How it's shipped in nuget.exe |
|---|---|---|
Nuget.CommandLine.{culture.Name}.{name}.dll |
This is the name of a DLL embedded as a resource. Since we rename NuGet.CommandLine.exe to NuGet.exe, {name} part becomes "NuGet.Resources" | Embedded in NuGet.exe |
NuGet.Commands.resources.dll |
Contains all strings from NuGet.Commands project | ILMerged |
LMK if you have more questions.
dce3d99 to
47c66e8
Compare
test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetHelpCommandTest.cs
Outdated
Show resolved
Hide resolved
388bf42 to
e1520db
Compare
e1520db to
0988261
Compare
0988261 to
d65fd9f
Compare
|
This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 7 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch. |
|
Reopening to add functional tests. |
Removed stderr logging code. Added more condition to intercept nuget.exe failed resources
Co-authored-by: Donnie Goodson <49205731+donnie-msft@users.noreply.github.com>
d65fd9f to
cb6d3c4
Compare
…cenario. Updated project file due to rebase (CPM repo onboarding)
|
Another approach would be to not merge this PR and find a workaround to use NuGet.Localization package to localize nuget.exe ; see https://github.com/NuGet/docs.microsoft.com-nuget/issues/2949 If you like this idea, please upvote this comment. Thanks! |
|
Wouldn't not merging this PR regress the experience for nuget.commands strings prior to us starting the work to update localization? IMO we should try to make this PR work and then listen for feedback. |
Ok, then, let's review this PR @NuGet/nuget-client |
Bug
Fixes: NuGet/Home#12097
Regression? Last working version: N/A
Description
This PR embeds nuget.resources assembly into nuget.exe and ILMerge nuget.commands resources, following the idea outline in the comment in nuget.exe project file:
NuGet.Client/src/NuGet.Clients/NuGet.CommandLine/NuGet.CommandLine.csproj
Lines 105 to 107 in be87c9e
Also, this PR adds code to intercept CurrentDomain.ResourceResolve events in nuget.exe when looking for NuGet resources to indicate that NuGet assembly contains the required resource
Over time, nuget.exe file size has increase. This PR represents a 265KB increase in file size, compared to the last nuget.exe version with localization on NuGet.CommandLine and NuGet.Commands assemblies
PR Checklist
PR has a meaningful title
PR has a linked issue.
Described changes
Tests
Documentation
Validation
Side to side comparison
nuget.exeInstallBefore: All messages are in English
After: Some messages are translated, some others not because those are strings from nuget.packagemanagement, which are not ILMerged.
nuget.exeRestoreBefore: some messages are localized
After: all restore messages are localized