-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy localized strings from ContextMenu into the resource root (#12491)
We chose to use the "ContextMenu" resource compartment when we changed the package name to Terminal in #12264 because it was more broadly localized than the rest of the application. It appears as though some platform features have trouble with the "more qualified" resource paths that #12264 required. To fix this, we will: 1. Copy all of the ContextMenu localizations into CascadiaPackage's resource root 2. Switch all manifest resource paths to use resources from the package root. Regressed in #12264 Closes #12384 Closes #12406 (tracked in microsoft/PowerToys#16118)
- Loading branch information
Showing
6 changed files
with
102 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
34 changes: 34 additions & 0 deletions
34
build/scripts/Copy-ContextMenuResourcesToCascadiaPackage.ps1
This file contains 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,34 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT license. | ||
|
||
$LocalizationsFromContextMenu = Get-ChildItem ./src/cascadia/TerminalApp/Resources -Recurse -Filter ContextMenu.resw | ||
$Languages = [System.Collections.HashTable]::New() | ||
$LocalizationsFromContextMenu | ForEach-Object { | ||
$Languages[$_.Directory.Name] = $_ | ||
} | ||
|
||
ForEach ($pair in $Languages.GetEnumerator()) { | ||
$LanguageDir = "./src/cascadia/CascadiaPackage/Resources/$($pair.Key)" | ||
$ResPath = "$LanguageDir/Resources.resw" | ||
$PreexistingResw = Get-Item $ResPath -EA:Ignore | ||
If ($null -eq $PreexistingResw) { | ||
Write-Host "Copying $($pair.Value.FullName) to $ResPath" | ||
New-Item -type Directory $LanguageDir -EA:Ignore | ||
Copy-Item $pair.Value.FullName $ResPath | ||
} Else { | ||
# Merge Them! | ||
Write-Host "Merging $($pair.Value.FullName) into $ResPath" | ||
$existingXml = [xml](Get-Content $PreexistingResw.FullName) | ||
$newXml = [xml](Get-Content $pair.Value.FullName) | ||
$newDataKeys = $newXml.root.data.name | ||
$existingXml.root.data | % { | ||
If ($_.name -in $newDataKeys) { | ||
$null = $existingXml.root.RemoveChild($_) | ||
} | ||
} | ||
$newXml.root.data | % { | ||
$null = $existingXml.root.AppendChild($existingXml.ImportNode($_, $true)) | ||
} | ||
$existingXml.Save($PreexistingResw.FullName) | ||
} | ||
} |
This file contains 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 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 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 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