Skip to content

Commit 20a1048

Browse files
committed
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) (cherry picked from commit 9501b23)
1 parent 0892a13 commit 20a1048

File tree

6 files changed

+102
-15
lines changed

6 files changed

+102
-15
lines changed

build/pipelines/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ jobs:
151151
152152
$Files | % { Move-Item -Verbose $_.Directory $_.Directory.Parent.Parent -EA:Ignore }
153153
pwsh: true
154+
- task: PowerShell@2
155+
displayName: Copy the Context Menu Loc Resources to CascadiaPackage
156+
inputs:
157+
filePath: ./build/scripts/Copy-ContextMenuResourcesToCascadiaPackage.ps1
158+
pwsh: true
154159
- task: PowerShell@2
155160
displayName: Generate NOTICE.html from NOTICE.md
156161
inputs:
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT license.
3+
4+
$LocalizationsFromContextMenu = Get-ChildItem ./src/cascadia/TerminalApp/Resources -Recurse -Filter ContextMenu.resw
5+
$Languages = [System.Collections.HashTable]::New()
6+
$LocalizationsFromContextMenu | ForEach-Object {
7+
$Languages[$_.Directory.Name] = $_
8+
}
9+
10+
ForEach ($pair in $Languages.GetEnumerator()) {
11+
$LanguageDir = "./src/cascadia/CascadiaPackage/Resources/$($pair.Key)"
12+
$ResPath = "$LanguageDir/Resources.resw"
13+
$PreexistingResw = Get-Item $ResPath -EA:Ignore
14+
If ($null -eq $PreexistingResw) {
15+
Write-Host "Copying $($pair.Value.FullName) to $ResPath"
16+
New-Item -type Directory $LanguageDir -EA:Ignore
17+
Copy-Item $pair.Value.FullName $ResPath
18+
} Else {
19+
# Merge Them!
20+
Write-Host "Merging $($pair.Value.FullName) into $ResPath"
21+
$existingXml = [xml](Get-Content $PreexistingResw.FullName)
22+
$newXml = [xml](Get-Content $pair.Value.FullName)
23+
$newDataKeys = $newXml.root.data.name
24+
$existingXml.root.data | % {
25+
If ($_.name -in $newDataKeys) {
26+
$null = $existingXml.root.RemoveChild($_)
27+
}
28+
}
29+
$newXml.root.data | % {
30+
$null = $existingXml.root.AppendChild($existingXml.ImportNode($_, $true))
31+
}
32+
$existingXml.Save($PreexistingResw.FullName)
33+
}
34+
}

src/cascadia/CascadiaPackage/Package-Dev.appxmanifest

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
Version="0.0.1.0" />
2121

2222
<Properties>
23-
<DisplayName>ms-resource:TerminalApp/ContextMenu/AppStoreNameDev</DisplayName>
23+
<DisplayName>ms-resource:AppStoreNameDev</DisplayName>
2424
<PublisherDisplayName>A Lone Developer</PublisherDisplayName>
2525
<Logo>Images\StoreLogo.png</Logo>
2626
</Properties>
@@ -38,16 +38,16 @@
3838
Executable="$targetnametoken$.exe"
3939
EntryPoint="$targetentrypoint$">
4040
<uap:VisualElements
41-
DisplayName="ms-resource:TerminalApp/ContextMenu/AppNameDev"
42-
Description="ms-resource:TerminalApp/ContextMenu/AppDescriptionDev"
41+
DisplayName="ms-resource:AppNameDev"
42+
Description="ms-resource:AppDescriptionDev"
4343
BackgroundColor="transparent"
4444
Square150x150Logo="Images\Square150x150Logo.png"
4545
Square44x44Logo="Images\Square44x44Logo.png">
4646
<uap:DefaultTile
4747
Wide310x150Logo="Images\Wide310x150Logo.png"
4848
Square71x71Logo="Images\SmallTile.png"
4949
Square310x310Logo="Images\LargeTile.png"
50-
ShortName="ms-resource:TerminalApp/ContextMenu/AppShortNameDev">
50+
ShortName="ms-resource:AppShortNameDev">
5151
<uap:ShowNameOnTiles>
5252
<uap:ShowOn Tile="square150x150Logo"/>
5353
<uap:ShowOn Tile="wide310x150Logo"/>
@@ -66,7 +66,7 @@
6666
<uap5:StartupTask
6767
TaskId="StartTerminalOnLoginTask"
6868
Enabled="false"
69-
DisplayName="ms-resource:TerminalApp/ContextMenu/AppNameDev" />
69+
DisplayName="ms-resource:AppNameDev" />
7070
</uap5:Extension>
7171
<uap3:Extension Category="windows.appExtensionHost">
7272
<uap3:AppExtensionHost>

src/cascadia/CascadiaPackage/Package-Pre.appxmanifest

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Version="0.5.0.0" />
2222

2323
<Properties>
24-
<DisplayName>ms-resource:TerminalApp/ContextMenu/AppStoreNamePre</DisplayName>
24+
<DisplayName>ms-resource:AppStoreNamePre</DisplayName>
2525
<PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
2626
<Logo>Images\StoreLogo.png</Logo>
2727
</Properties>
@@ -127,16 +127,16 @@
127127
Executable="$targetnametoken$.exe"
128128
EntryPoint="$targetentrypoint$">
129129
<uap:VisualElements
130-
DisplayName="ms-resource:TerminalApp/ContextMenu/AppNamePre"
131-
Description="ms-resource:TerminalApp/ContextMenu/AppDescriptionPre"
130+
DisplayName="ms-resource:AppNamePre"
131+
Description="ms-resource:AppDescriptionPre"
132132
BackgroundColor="transparent"
133133
Square150x150Logo="Images\Square150x150Logo.png"
134134
Square44x44Logo="Images\Square44x44Logo.png">
135135
<uap:DefaultTile
136136
Wide310x150Logo="Images\Wide310x150Logo.png"
137137
Square71x71Logo="Images\SmallTile.png"
138138
Square310x310Logo="Images\LargeTile.png"
139-
ShortName="ms-resource:TerminalApp/ContextMenu/AppShortNamePre">
139+
ShortName="ms-resource:AppShortNamePre">
140140
<uap:ShowNameOnTiles>
141141
<uap:ShowOn Tile="square150x150Logo"/>
142142
<uap:ShowOn Tile="wide310x150Logo"/>
@@ -160,7 +160,7 @@
160160
<uap5:StartupTask
161161
TaskId="StartTerminalOnLoginTask"
162162
Enabled="false"
163-
DisplayName="ms-resource:TerminalApp/ContextMenu/AppNamePre" />
163+
DisplayName="ms-resource:AppNamePre" />
164164
</uap5:Extension>
165165
<uap3:Extension Category="windows.appExtension">
166166
<uap3:AppExtension Name="com.microsoft.windows.console.host"

src/cascadia/CascadiaPackage/Package.appxmanifest

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Version="1.0.0.0" />
2222

2323
<Properties>
24-
<DisplayName>ms-resource:TerminalApp/ContextMenu/AppStoreName</DisplayName>
24+
<DisplayName>ms-resource:AppStoreName</DisplayName>
2525
<PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
2626
<Logo>Images\StoreLogo.png</Logo>
2727
</Properties>
@@ -127,16 +127,16 @@
127127
Executable="$targetnametoken$.exe"
128128
EntryPoint="$targetentrypoint$">
129129
<uap:VisualElements
130-
DisplayName="ms-resource:TerminalApp/ContextMenu/AppName"
131-
Description="ms-resource:TerminalApp/ContextMenu/AppDescription"
130+
DisplayName="ms-resource:AppName"
131+
Description="ms-resource:AppDescription"
132132
BackgroundColor="transparent"
133133
Square150x150Logo="Images\Square150x150Logo.png"
134134
Square44x44Logo="Images\Square44x44Logo.png">
135135
<uap:DefaultTile
136136
Wide310x150Logo="Images\Wide310x150Logo.png"
137137
Square71x71Logo="Images\SmallTile.png"
138138
Square310x310Logo="Images\LargeTile.png"
139-
ShortName="ms-resource:TerminalApp/ContextMenu/AppShortName">
139+
ShortName="ms-resource:AppShortName">
140140
<uap:ShowNameOnTiles>
141141
<uap:ShowOn Tile="square150x150Logo"/>
142142
<uap:ShowOn Tile="wide310x150Logo"/>
@@ -160,7 +160,7 @@
160160
<uap5:StartupTask
161161
TaskId="StartTerminalOnLoginTask"
162162
Enabled="false"
163-
DisplayName="ms-resource:TerminalApp/ContextMenu/AppName" />
163+
DisplayName="ms-resource:AppName" />
164164
</uap5:Extension>
165165
<uap3:Extension Category="windows.appExtension">
166166
<uap3:AppExtension Name="com.microsoft.windows.console.host"

src/cascadia/CascadiaPackage/Resources/en-US/Resources.resw

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,52 @@
117117
<resheader name="writer">
118118
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120+
<data name="AppName" xml:space="preserve">
121+
<value>Terminal</value>
122+
<comment>{Locked}</comment>
123+
</data>
124+
<data name="AppNameDev" xml:space="preserve">
125+
<value>Terminal Dev</value>
126+
<comment>{Locked}</comment>
127+
</data>
128+
<data name="AppNamePre" xml:space="preserve">
129+
<value>Terminal Preview</value>
130+
<comment>{Locked}</comment>
131+
</data>
132+
<data name="AppStoreName" xml:space="preserve">
133+
<value>Windows Terminal</value>
134+
<comment>{Locked}</comment>
135+
</data>
136+
<data name="AppStoreNameDev" xml:space="preserve">
137+
<value>Windows Terminal Dev</value>
138+
<comment>{Locked}</comment>
139+
</data>
140+
<data name="AppStoreNamePre" xml:space="preserve">
141+
<value>Windows Terminal Preview</value>
142+
<comment>{Locked}</comment>
143+
</data>
144+
<data name="AppShortName" xml:space="preserve">
145+
<value>Terminal</value>
146+
<comment>{Locked}</comment>
147+
</data>
148+
<data name="AppShortNameDev" xml:space="preserve">
149+
<value>Terminal Dev</value>
150+
<comment>{Locked}</comment>
151+
</data>
152+
<data name="AppShortNamePre" xml:space="preserve">
153+
<value>Terminal Preview</value>
154+
<comment>{Locked}</comment>
155+
</data>
156+
<data name="AppDescription" xml:space="preserve">
157+
<value>The New Windows Terminal</value>
158+
<comment>{Locked}</comment>
159+
</data>
160+
<data name="AppDescriptionDev" xml:space="preserve">
161+
<value>The Windows Terminal, but Unofficial</value>
162+
<comment>{Locked}</comment>
163+
</data>
164+
<data name="AppDescriptionPre" xml:space="preserve">
165+
<value>Windows Terminal with a preview of upcoming features</value>
166+
<comment>{Locked}</comment>
167+
</data>
120168
</root>

0 commit comments

Comments
 (0)