-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Update the manifest resource names for the localized resources embedded in satellite assemblies #27756
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
Merged
Dongbo Wang (daxian-dbw)
merged 2 commits into
PowerShell:master
from
daxian-dbw:manifest-name
Aug 3, 2026
Merged
Update the manifest resource names for the localized resources embedded in satellite assemblies #27756
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
test/powershell/engine/ResourceValidation/LocalizedResource.Tests.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|
|
||
| Describe "Localized resource files validation" -Tags "CI" { | ||
|
|
||
| BeforeAll { | ||
| $repoSrcDir = (Resolve-Path (Join-Path $PSScriptRoot ../../../../src)).Path | ||
|
|
||
| # Folders that exist in 'resources' folder but are not a localized resource directory. | ||
| $excludeDirs = @('Graphics') | ||
|
|
||
| # VS_Main_Languages set, the same as what .NET uses for localization. | ||
| $langSet = 'cs', 'de', 'es', 'fr', 'it', 'ja', 'ko', 'pl', 'pt-BR', 'ru', 'tr', 'zh-Hans', 'zh-Hant' | ||
| $asmDirs = @( | ||
| 'Microsoft.Management.Infrastructure.CimCmdlets' | ||
| 'Microsoft.Management.UI.Internal' | ||
| 'Microsoft.PowerShell.Commands.Diagnostics' | ||
| 'Microsoft.PowerShell.Commands.Management' | ||
| 'Microsoft.PowerShell.Commands.Utility' | ||
| 'Microsoft.PowerShell.ConsoleHost' | ||
| 'Microsoft.PowerShell.CoreCLR.Eventing' | ||
| 'Microsoft.PowerShell.Security' | ||
| 'Microsoft.WSMan.Management' | ||
| 'System.Management.Automation' | ||
| ) | ||
|
|
||
| $asmNames = $asmDirs | ForEach-Object { | ||
| if ($_ -eq 'Microsoft.Management.UI.Internal') { | ||
| 'Microsoft.PowerShell.GraphicalHost' | ||
| } else { | ||
| $_ | ||
| } | ||
| } | ||
|
|
||
| $testCases1 = @( | ||
| $asmDirs | ForEach-Object { @{ AssemblyDir = $_ } } | ||
| ) | ||
| $testCases2 = @( | ||
| $langSet | ForEach-Object { @{ Language = $_ } } | ||
| ) | ||
| } | ||
|
|
||
| It "Assembly folders with resources should match with records" { | ||
| try { | ||
| Push-Location $repoSrcDir | ||
| $assemblies = Get-ChildItem 'resources' -Recurse -Directory | ForEach-Object { $_.Parent.Name } | ||
|
|
||
| ## Verifies that the assembly folders containing resource files match the expected records in $asmDirs. | ||
| $result = Compare-Object -ReferenceObject $asmDirs -DifferenceObject $assemblies | ||
| $result | Should -Be $null -Because "The assembly folders with resources do not match the expected records:`n$($result | Out-String)." | ||
|
|
||
| ## Verifies that the default English resource files exist and match the expected count. | ||
| $defaultCultureResources = $assemblies | ForEach-Object { Get-ChildItem "$_/resources/*.resx" } | ||
| $defaultCultureResources | Should -HaveCount 150 -Because "Default English resource files count: $($defaultCultureResources.Count); Expected count: 150." | ||
| } | ||
| finally { | ||
| Pop-Location | ||
| } | ||
| } | ||
|
|
||
| It "Localized resource files for '<AssemblyDir>' should match the records" -TestCases $testCases1 { | ||
| param($AssemblyDir) | ||
|
|
||
| ## Get the full path to the resources directory for the current assembly folder. | ||
| $resDir = Join-Path $repoSrcDir $AssemblyDir 'resources' | ||
| ## Get all the localized resource directory names under the resources directory. | ||
| $locDirNames = @(Get-ChildItem $resDir -Directory | ForEach-Object Name | Where-Object { $_ -notin $excludeDirs }) | ||
|
|
||
| ## Verifies that the localized resource directories match the expected language set. | ||
| $results = Compare-Object -ReferenceObject $langSet -DifferenceObject $locDirNames | ||
| $results | Should -Be $null -Because "The localized resource directories for '$AssemblyDir' do not match the expected language set:`n$($results | Out-String)." | ||
|
|
||
| ## Get the default English resource file names without extensions. | ||
| $default = @(Get-ChildItem "$resDir/*.resx" | ForEach-Object { [System.IO.Path]::GetFileNameWithoutExtension($_.Name) }) | ||
|
|
||
| foreach ($lang in $langSet) { | ||
| ## Get the full path to the localized resource directory for the current language. | ||
| $langDir = Join-Path $resDir $lang | ||
| ## Get all the localized resource file names without extensions for the current language. | ||
| $langResources = @(Get-ChildItem "$langDir/*.resx" | ForEach-Object { [System.IO.Path]::GetFileNameWithoutExtension($_.Name) }) | ||
|
|
||
| ## The localized resource file should have the same base name as the default English resource file, with the language suffix added. | ||
| $expectedNames = @($default | ForEach-Object { "$_.$lang" }) | ||
| ## Verifies that the localized resource file names match the expected names. | ||
| $langResults = Compare-Object -ReferenceObject $expectedNames -DifferenceObject $langResources | ||
| $langResults | Should -Be $null -Because "The names of localized resource files for '$lang' in '$AssemblyDir' do not match the default English files:`n$($langResults | Out-String)." | ||
| } | ||
| } | ||
|
|
||
| It "Satellite assemblies should be produced for '<Language>'" -TestCases $testCases2 -Skip:(!$IsWindows) { | ||
| param($Language) | ||
|
|
||
| $satDir = Join-Path $PSHOME $Language | ||
| Test-Path $satDir | Should -BeTrue -Because "Satellite directory for language '$Language' should exist." | ||
|
|
||
| foreach ($asmName in $asmNames) { | ||
| $satAssemblyPath = Join-Path $satDir "$asmName.resources.dll" | ||
| Test-Path $satAssemblyPath | Should -BeTrue -Because "Satellite assembly '$asmName.resources.dll' for language '$Language' should exist." | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.